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:
Hi adatapost!
Thanks a lot for the useful hint. Do you know of any straightforward way of either converting theGoogle csv file to ASCII, or reading a Unicode file in C/C++? I tried googleing how to do that, but the answers seem to be extremely complicated...
Any ideas what's going wrong?
The first error message referes to line 16; it says
Quote ...
error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ifstream'
1> c:\program files\microsoft visual studio 8\vc\include\string(528) : see declaration of 'std::getline'
But this doesn't help me in any ways..
Sorry I might be being stupid but I have just started using C/C++.
Thanks a lot. I have been trying all sorts of code from the internet to convert unicode strings to ascii strings, but so far nothing works. Most of the stuff that I find online is pretty long, and impossible to understand for me as a beginner.
The following code should do it, but I get an error when compiling.
if u can do some manual work then
1)Open your Unicode file with notepad and save as ANSI.
Then read that file it using C
or else
in DOS use
command:type filename > filename1
Then read the filename1 using C
-----------
If your want to develop a Unicode reading tool using C then
You can go by Ancient Dragon or adatapost.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.