"Not all scattered pieces are of broken glass"
I had a problem
Symptoms:
- Language: C++, Operating System: Windows
- Target Audience: Programmers
- Sub Area: Reading ASCII / UTF-8 files from the disk using C++ streams.
- Trouble: How to handle files whose file names contains non-ASCII characters?? (coz ifstream takes a ASCII file path
)
Solution:
- Use _wfopen_s(), the safe version of _wfopen(), which takes a wide-character file name & gives a FILE pointer i.e; FILE*.
- Use the obtained FILE* to create a stream, like ifstream in(fp);
- We used wide-character file name & are reading the file byte-by-byte (actually, its char). DONE !!
BTW, I got help from here ! Hope this savesĀ time for someone out there…
| Print article | This entry was posted by Sai Prasad on December 1, 2009 at 5:22 AM, and is filed under Technical. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |