Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No O_BINARY and O_TEXT flags in Linux?

Tags:

c

file

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?

like image 848
Pieter Avatar asked Feb 15 '10 15:02

Pieter


2 Answers

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

like image 190
Tim Yates Avatar answered Sep 20 '22 08:09

Tim Yates


It's a *nix thing. *nix operating systems don't do automatic linefeed conversion for I/O on "text" files so O_TEXT and O_BINARY flags wouldn't make sense.

like image 41
nobody Avatar answered Sep 19 '22 08:09

nobody