damn i did what you told me to do but., damn i have no luck.. please take a look....
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct data{
char fname[25];
char lname[25];
char fnumb[10];
}ph;
char q;
int main()
{
do
{
FILE *info;
info = fopen("ph","w");
if( info == NULL )
{
printf("Fatal Error. Could not open file for writing.\n");
exit( EXIT_FAILURE );
}
printf("\nType in the first and last one of the person\n");
printf("please add a space when typing the last name\n");
scanf("%s %s",&ph.fname, &ph.lname);
puts("\n\n");
printf("Please type in the persons phone number\n\n");
scanf("%s",&ph.fnumb);
puts("\n");
fprintf(info,"Name: %s %s\n",ph.fname, ph.lname);
fprintf(info,"Phone#: %s\n\n",ph.fnumb);
printf("Press q to quit or any other key to continue");
scanf("%c",&q);
q = tolower(q);
}
while(q != 'q');
printf("\nexiting...");
sleep(1);
fclose(ph);
printf("Good bye");
return 0;
}