Hi,
I have a text file which contains some text. Now I want to get the some variables out of the TextFiles.
The format of the file is something like this:
MyVariables
a,b,c,d
.....
....
...
end
So now I want to parse the text file and get a,b,c,d into a array or a queue or stack (some sort of collection).
At this point I am able to read the file using the following code:
Code:
int main() {
FILE *fp;
char name[25];
char buff[BUFSIZ];
float num;
char ch;
if((fp=fopen("AboutMe.txt","r"))==NULL)
{
perror("File cannot be opened");
getchar();
}
while((ch = fgetc(fp)) != EOF)
{
if(ch == 13)
printf("Line break has been found");
printf("%c",ch);
}
getchar();
return 0;
Thanks,