Linux中没有O_BINARY和O_TEXT标志? [英] No O_BINARY and O_TEXT flags in Linux?

查看:555
本文介绍了Linux中没有O_BINARY和O_TEXT标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在Linux中使用系统级IO时,我注意到编译器识别了 O_RDONLY O_RDWR 标志,但它不知道 O_BINARY O_TEXT 标志的含义。



这是一个Linux的东西吗?

解决方案

不管怎样,不区分二进制和文本文件。因此,这个名字没有标准常量。你可以在Linux中手动定义常量为零,如果你想将它们包含在你的代码中以实现可移植性的话。


$ b

http://unix.derkeiler.com/Newsgroups/comp.unix.programmer/2007-03/msg00147。 html


When using system-level IO in Linux, I noticed that the compiler recognized the O_RDONLY and O_RDWR flags, but it had no clue whatsoever as to the meaning of the O_BINARY and O_TEXT flags.

Is this a Linux thing?

解决方案

Linux, and just about every flavor of Unix for that matter, doesn't differentiate between binary and text files. Thus, there are no standard constants with that name. You can manually define the constants to be zero in Linux if you want to include them in your code for portability purposes.

http://unix.derkeiler.com/Newsgroups/comp.unix.programmer/2007-03/msg00147.html

这篇关于Linux中没有O_BINARY和O_TEXT标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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