Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void main(void){
- char fname[20];
- char lname[20];
- printf("Please Enter Your First Name: ");
- scanf("%s", &fname);//This way will not include things after space
- printf("Please Enter Your Last Name: ");
- scanf("%s", &lname);//This way will not include things after space
- FILE *f;
- f = fopen("name.log","a");
- fprintf(f,"%s %s \n",fname, lname);
- fclose(f);
- printf("Hello %s,\nYour name as been saved.\n", fname);
- printf("=============================\n");
- printf("Name Log Data\n");
- printf("=============================\n");
- char t;
- f = fopen("name.log","r");
- while((t = fgetc(f)) != EOF )
- printf("%c", t);
- fclose(f);
- printf("-------------------------------\n");
- printf("Please Press Enter to Continue.");
- getchar();
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement