使用本机 Win32 以“C"读取文本文件(Unicode) [英] Read text file (Unicode) in 'C' using native Win32

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

问题描述

我有一个使用 CreateFile() 和 WriteFile() 创建的面向行的文本文件 (Unicode).

I have a line-oriented text file (Unicode) that was created using CreateFile() and WriteFile().

使用 ReadFile() 将该文件作为二进制流读取很简单,但需要额外的低级处理才能将其分成几行.

Reading that file as a binary stream using ReadFile() is straightforward, but extra low-level processing is needed to break it into lines.

是否有 Win32 函数可以为我执行此操作?

Is there a Win32 function that does this for me?

同样,请注意它是在C"(不是 C++)中,我不想使用 POSIX/ANSI C 函数,例如 readline().

Again, please note that it's in 'C' (not C++) and I don't want to use POSIX/ANSI C functions such as readline().

如果上述问题的答案是否定的,那么仅使用本机 Win32 C 函数完成读取面向行的文本文件的最短代码"是什么?例如使用 ReadFile()、StrChr() 等

If the answer to the aforementioned question is negative, what would be the "shortest code" to accomplish reading a line-oriented text file, using native Win32 C functions only? e.g. using ReadFile(), StrChr(), etc.

谢谢.

推荐答案

AFAIK 没有用于逐行读取文件的 win32 函数.

AFAIK there is no win32 function for reading file line by line.

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

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