Misc Functions

Here are some miscellaneous buffered I/O functions.

int fileno (FILE *stream);

This returns the file descriptor that the stream is wrapped around. This is handy if you need to use fcntl(), fchmod(), fstat(), or the dup() functions.

int getw (FILE *stream);

int putw (int w, FILE *stream);

These are like getc()/putc() but read or write an integer. The integers are not written in a canonical form (discussed in Chapter 14: Network Programming With Sockets), so if you want to be portable, you will need to put the bytes into a known byte order.

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.