setmode() Set File-Translation Mode
#include <io.h> Required for declarations only
#include <fcntl.h>
int setmode(handle,mode);
int handle; File handle
int mode; New translation mode
setmode() sets the translation mode of the file associated with
'handle' to 'mode'. 'mode' must be one of the following constants:
O_TEXT Text (translated) mode. In text mode,
carriage-return-line-feed combinations are translated
to a line-feed on input. The line-feed characters
are translated back to a carriage-return and
line-feed on output.
O_BINARY Set binary (untranslated) mode. The above
translations are suppressed.
setmode() is typically used to modify the default translation mode of
'stdin', 'stdout', 'stderr', 'stdaux', and 'stdout' (standard input,
standard output, standard error, standard auxiliary, and standard
printrt). 'stdin', 'stdaux', and 'stderr' streams are opened in text
mode by default. 'stdaux' and 'stdprn' are opened in binary mode.
setmode() can also be used on files and can be used to change the
mode of a file after it has been opened.
Returns: The previous translation mode, if successful; or -1 if an
error occurs. On error, 'errno' (defined in <stdlib.h>)
is set to either:
EBADF Invalid file handle, or
EINVAL Invalid 'mode' argument.
-------------------------------- Example ---------------------------------
This example sets 'stdout' to binary mode.
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
main()
{
int rslt;
rslt = setmode(fileno(stdout),O_BINARY);
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster