INtime SDK Help
setmode

Sets binary or text translation mode of a file.

#include <fcntl.h>
#include <io.h>

int setmode (int handle, int mode);

Parameters

handle
Descriptor referring to an open file.
mode
New translation mode.

Remarks

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.

Return Values

The previous translation mode.
Success.
-1 on error, and the function sets errno to one of these values:
EBADF Invalid file descriptor.
EINVAL Invalid mode argument (neither O_TEXT nor O_BINARY).
Failure.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/io.h fcntl.h
io.h
clib.lib

More info.

See Also

creat, fflush