i want to know how to read all the message inside the file including their spacing,indents if possible using File Handling... can that be done?
content of data1.txt:
First Name: (TAB)John Doe
Last name:(TAB) Manly
Height:(TAB) 5'7
Weight:(TAB)164 kls
Address:(TAB)Somewhere but here,
(TAB)but not to far City.
here is my program:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
main()
{
FILE *fp1;
char x[100],y[100];
fp1=fopen("data1.txt","r");
while(!feof(fp1))
{ fscanf(fp1,"%s",&x);
printf("%s ",x);
}
fclose(fp1);
printf("\n\n");
system("pause");
}
can i use only one variable for all the content of the file??? i want to include all the grammars or spacing...can that be possible?
if my program is wrong from the start...please feel free to rewrite it...thank you all