I have a program that reads the data from a stream.
Let's just pretend that I already made file in C:\ (record.txt) and I wrote the following words:
hello world
me you
But the program will display in this manner:
hello
world
me
you
instead of:
hello world
me you
"PLEASE HELP ME WITH THIS!!!" here's my code...
#include<stdio.h>
int main()
{
FILE *fp;
fp=fopen("c:\\record.txt","r");
char name[30];
printf("NAME:\n");
while(!feof(fp)) {
fscanf(fp,"%s",&name);
if(feof(fp))
break;
printf("%s\n",name);
}
return 0;
}
Please help me!