visual c++ - Read Unicode files C++ -
i have simple question ask. have utf 16 text file read wich starts fffe. c++ tools deal kind of file? want read it, filter lines, , display result.
it looks simple, have experience in work plain ascci files , i'm in hurry. i'm using vs c++, i'm not want work managed c++.
regards
here put simple example
wifstream file; file.open("c:\\applog.txt", ios::in); wchar_t buffer[2048]; file.seekg(2); file.getline(buffer, bsize-1); wprintf(l"%s\n", buffer); file.close();
you can use fgetws, reads 16-bit characters. file in little-endian,byte order. since x86 machines little-endian should able handle file without trouble. when want output, use fwprintf.
also, agree more information useful. instance, may using library abstracts away of this.
Comments
Post a Comment