使用Redafile读取Unicode文件 [英] Reading Unicode file using Redafile

查看:86
本文介绍了使用Redafile读取Unicode文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用MSDN的Readfile api读取一个unicode文件 http://msdn.microsoft.com/en-us/library/windows/desktop/aa365467(v = vs.85).aspx [ ^ ]。



Hi, I have to read a unicode file using Readfile api of MSDNhttp://msdn.microsoft.com/en-us/library/windows/desktop/aa365467(v=vs.85).aspx[^].

char*	pBuf = NULL;
....
pBuf = (char*)new char[ dwFileSize+1 ];
bResult = ::ReadFile( hFile, pBuf, dwFileSize, &br, NULL );





但它即将到来pBuf中的垃圾值?



任何想法如何解决这个问题。以上代码适用于多字节文件...



注意:如果您知道解决方案,请发表评论。



But it is coming garbage value in pBuf?

Any Idea how to solve this. Above code fine for Multibyte files...

NOTE: Please comment / ans if you know solution.

推荐答案

您应该正确解释文件内容。理查德的行程可能会有所帮助:处理C /中的简单文本文件C ++ [ ^ ]。
You should properly interpret the file content. Richard''s trip might be helpful: Handling simple text files in C/C++[^].


ReadFile据我所知并不关心unicode,它只是从流中读取一些数据并返回给你。所以现在你需要解释它们。

有apis转换为unicode并返回。 (如MultiByteToWildChar和Wildchar..ToByte)



jkchan

[删除个人网站链接]
ReadFile as far as i know is not concerned about unicode, it just reads some amount of data from stream and returns to you. So now you need to interpret them.
there are apis to convert to unicode and back. (like MultiByteToWildChar and Wildchar..ToByte)

jkchan
[removed link to personal site]


这篇关于使用Redafile读取Unicode文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆