ok this is how i did it.... i was using fprintf and iwas getting lots of errors.. but i did it this way and all it did was just creat the file info... check it out..
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct data{
char fname[25];
char lname[25];
char fnumb[10];
}ph;
int main()
{
FILE *info;
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");
printf("Name: %s %s\n",ph.fname, ph.lname);
printf("Phone#: %s\n\n",ph.fnumb);
info = fopen("info","w");
if( info == NULL )
{
printf("Fatal Error. Could not open file for writing.\n");
exit( EXIT_FAILURE );
}
fclose(info);
return 0;
}
Just in case this is the error that i get when i add fprintf
ph.c: In function `main':
ph.c:25: warning: passing arg 1 of `fprintf' from incompatible pointer type
ph.c:25: too few arguments to function `fprintf'
ph.c:26: warning: passing arg 1 of `fprintf' from incompatible pointer type
ph.c:26: too few arguments to function `fprintf'
ph.c:30: warning: passing arg 1 of `fprintf' from incompatible pointer type
ph.c:30: too few arguments to function `fprintf'