- #1
RedX
- 970
- 3
Is fcntl.h more fundamental than stdio.h?
Using just stdio.h, I can define a FILE type, and use an fopen() command to open a file and return the address of the file into the FILE variable.
Using fcntl.h, I use open() instead of fopen(), and instead of returning a FILE type, open() returns an integer that's called a file descriptor.
fcntl.h I believe is only for Linux, while stdio.h is for any operating system that runs C.
Would I be correct in saying that each operating system has to write their own stdio.h that meets C standards, and Linux uses fcntl.h to do that, while Windows uses windows.h?
So if I look at stdio.h for Linux, it would define fopen() in terms of open() from fcntl.h, and similarly with Windows except using Window's version of an open() command to define fopen()?
Using just stdio.h, I can define a FILE type, and use an fopen() command to open a file and return the address of the file into the FILE variable.
Using fcntl.h, I use open() instead of fopen(), and instead of returning a FILE type, open() returns an integer that's called a file descriptor.
fcntl.h I believe is only for Linux, while stdio.h is for any operating system that runs C.
Would I be correct in saying that each operating system has to write their own stdio.h that meets C standards, and Linux uses fcntl.h to do that, while Windows uses windows.h?
So if I look at stdio.h for Linux, it would define fopen() in terms of open() from fcntl.h, and similarly with Windows except using Window's version of an open() command to define fopen()?