Dear all,
I have a weird problem reading a file using fgets. The code below should read the first line of the file "F:\\filename.csv". It works for all sorts of files that I create myself, but it does NOT work for certain files that I download from the internet.
More precisely, I download a csv file from Google Insight (see http://www.google.com/insights/search/#q=London&cmpt=q), and when I try the code on the downloaded file, I don't get the first line but the string has the following value: "ÿþW", which displays as a little square, followed by a capital "W".
Any ideas what's going wrong?
This is the code that I'm using:
#include <stdio.h>
#include <string.h>
int main ()
{
FILE *in=fopen("F:\\filename.csv","r");
char mystring [100];
fgets (mystring , 100 , in);
puts (mystring);
fclose (in);
return 0;
}
I appreciate any help!
Thanks a lot,
Anne