Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>setmode() set file-translation mode</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 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', which must be one of the following two constants:

         O_TEXT     Text (translated) mode. In text mode,
                    carriage-return-line-feed combinations are translated
                    to a line-feed on input.  On output, the line-feed
                    characters are translated back to a carriage-return-
                    line-feed combination.

       O_BINARY     Set binary (untranslated) mode.  The carriage-return-
                    line-feed translations are suppressed.

    setmode() is typically used to modify the default translation mode of
    'stdin', 'stdout', 'stderr', 'stdaux', and 'stdprn' (standard input,
    standard output, standard error, standard auxiliary, and standard
    print). '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. On error -1
                is returned and  'errno' (defined in <stdlib.h>) is set
                to either:

                    EBADF     Invalid file handle, or
                    EINVAL    Invalid 'mode' argument.

 Portability:   Applies to MS DOS only.

   -------------------------------- 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);
           }


See Also: creat() fopen() open()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson