Sets binary or text translation mode of a file.
#include <fcntl.h> #include <io.h> int setmode (int handle, int mode);
handle
mode
mode
must be one of these manifest constants:
Value | Description |
---|---|
O_TEXT | Sets text (translated) mode. <CR><LF> combinations are translated into a single <LF> character on input. <LF> characters are translated into <CR><LF> combinations on output. |
O_BINARY | Sets binary (untranslated) mode and suppresses the above translations. |
setmode is typically used to modify the default translation mode of stdin, stdout, and stderr, but can be used on any file.
Note:If multiple threads or processes are collecting data from the same file or stream, use binary mode. Otherwise, the thread or process receives scrambled data.
Do not try to change a stream's mode while the stream buffer is active. Call fflush first.
EBADF | Invalid file descriptor. |
EINVAL | Invalid mode argument (neither O_TEXT nor O_BINARY). |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/io.h | fcntl.h io.h |
clib.lib |