Feature :
1. You can create a new text file, save it in your file Ex: your file name.c.
2. You can view the files
3. You can protect files with password
Source Code:
include <stdio.h>
include <stdlib.h>
include <string.h>
include <conioh>
int Select, load, load2;
char FN [20], Word [20], text;
FILE * file1;
int menu ();
void create ();
void pass ();
void view ();
void delete ();
void Main ()
{
System ("CLS");
System ("COLOR 4f");
printf (" \ n \ n \ T \ T \ tNote Book By SHOAEB \ n \ T \ T \ tPress Any Key To Run .. \ n \ n \ n \ n ");
getch ();
printf ("\ tPlease
4f ");
pass ();
System ("CLS");
System ("COLOR 4f");
menu ();
}
int menu ()
{
do {
System ("CLS");
System ("COLOR 4f");
printf ("\ n \ n \ n \ T ** NOTE BOOK ** \ n \ T ______________________ \ n");
printf ("\ n \ t1CREATE A NOTE \ n \ t2VIEW NOTE \ n \ t3DELETE NOTE \ n \ t4LOG ME OUT (Any Key) \ n ");
printf ("\ n \ tenter Your choice:");
scanf ("% D", & Select);
switch (Select)
{
Case 1:
create ();
BREAK;
Case 2:
view ();
BREAK;
Case 3:
delete ();
BREAK;
Default:
printf ("\ n \ n \ T \ tPlease wait while Logging Out");
for (load = 1; load <= 60; load ++) {
for (load2 = 0; load2 <= 10000000; load2 ++);}
pass ();
}
} while (1);
}
void create ()
{System ("CLS");
System ("COLOR 4f ");
printf ("\ n \ n \ n \ T \ T *** NOTE *** CREATE A \ n \ n \ n");
printf ("\ tenter The note name:");
Gets (FN );
Gets (FN);
file1 = fopen (FN, "w");
printf ("\ n \ tPLEASE PRESS ENTER THE TEXT '~' TO
Saved \ n \ tpress Any Key. ");
getch ();
System ("CLS");
System ("COLOR 4f");
BREAK;
}}
}
void view () {
System ("CLS");
System (" COLOR 4f ");
printf ("\ n \ n \ n \ tenter note name:");
Gets (FN);
Gets (FN);
file1 = fopen (FN, "R");
If (file1 == NULL)
{
printf ("\ n \ n \ tNote Not Found");
goto loop1;
}
while (! feof (file1))
{
text = fgetc (file1);
printf ("% c", text);
}
loop1:
fclose ( file1);
printf ("\ n \ tPress Any Key to return Main Menu ..");
getch ();
System ("CLS");
System ("COLOR 4f");
}
void delete ()
{
System ("CLS ");
System ("COLOR 4f");
printf ("\ n \ tenter Note The name:");
Gets (FN);
Gets (FN);
file1 = fopen (FN, "R");
If (file1 = = NULL)
{
printf ("\ n \ tNote Not Found!");
goto loop2;
}
fclose (file1);
If (strcmp (FN, FN) == 0)
{
Remove (FN);
printf ("\ n \ n \ tNote Has Been Deleted successfully! \ n ");
goto loop2;
}
else
printf ("\ n \ Terror! \ n");
loop2: printf ("\ n \ n \ tPress Any Key to Continue ..." );
getch ();
System ("CLS");
System ("COLOR 4f");
}
void pass () {
FILE * FP;
char c [100], s [100];
int I;
cr:
System (" CLS ");
System ("COLOR 4f");
printf ("\ n \ n \ n \ T \ T SECURITY CHECK *** *** \ n");
printf ("\ n \ T \ t1CREATE A NEW PASSWORD \ n \ n \ T \ t2LOGIN NOTE TO BOOK \ n \ n \ T \ t3EXIT \ n ");
scanf ("% D", & I);
If (I == 1) {
System ( "CLS");
System ("COLOR 4f");
printf ("\ n \ n \ T \ tCreate Password:");
Gets (c);
Gets (c);
FP = fopen ("C: / #", "w");
fputs (c, FP);
fclose (FP);
printf ("\ n \ T \ tSuccesfully CreatedNow login \ n \ n \ a");
getch ();
goto cr;
}
else If (I == 2) {
FP = fopen ("C: / #", "R");
If (FP == NULL) {
printf ("\ n \ n \ T \ tErorrCreate A password 1st \ a ");
fclose (FP);
getch ();
goto cr;
}
else {
System ("CLS");
System ("COLOR 4f");
printf ("\ n \ n \ T \ tenter Password to login to Notebook: ");
Gets (s);
Gets (s);
fgets (c, 100, FP);
If (strcmp (s, c) == 0) {
printf ("\ n \ n \ T \ ... press tMatched Any Key \ n \ n \ n ");
getch ();
System ("CLS");
}
else {
printf ("\ n \ n \ T \ tWrong Any Key passwordpress Again try to \ a \ n \ n \ n ");
getch ();
System ("CLS");
System ("COLOR 4f");
goto cr;
}
fclose (FP);
}
}
else {
exit (0);
}
}



No comments:
Post a Comment