Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

How to read file in Unicode format....

Hi everybody,
I have a file which is in unicode encoding form. I want to read that file in unicode form , how can it be possible in C.
Thank you in advance.
Regards,
Chris.
[198 byte] By [chiragkapadiya] at [2007-11-11 10:20:00]
# 1 Re: How to read file in Unicode format....
I case of Visual Studio 2005, I think you can specify the Unicode encoding in fopen call:
FILE * f = fopen("c:\\test.txt", "rt, ccs=UNICODE");
For reading a line try:
wchar_t line[1024];
fgetws(line, 1024, f);
I hope this helps.
Viorel at 2007-11-11 20:59:10 >
# 2 Re: How to read file in Unicode format....
Thank you for your reply.

Actually I want to read printer spool file. I think it is in multibyte format.
Can anyone specify me how to read? I am not getting correct result while I am reading as a wide character too.

Regards,
Chirag.
chiragkapadiya at 2007-11-11 21:00:10 >