Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>setmode</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
setmode
=======

Syntax
------

     #include <io.h>
     
     int setmode(int file, int mode);

Description
-----------

This function sets the mode of the given FILE to MODE, which is either
`O_TEXT' or `O_BINARY'.  It will also set the file into either cooked
or raw mode accordingly, and set any `FILE*' objects that use this file
into text or binary mode.

When called to put FILE that refers to the console into binary mode,
`setmode' will disable the generation of `SIGINT' when you press
`Ctrl-C' (`Ctrl-Break' will still cause `SIGINT'), because many
programs that use binary reads from the console will also want to get
the `-characters.  You can use the `__djgpp_set_ctrl_c' library
function (__djgpp_set_ctrl_c:.) if you want `Ctrl-C' to generate   
interrupts while console is read in binary mode.

Note that, for buffered streams (`FILE*'), you must call `fflush'
(fflush:.) before `setmode', or call `setmode' before writing   
anything to the file, for proper operation.

Return Value
------------

When successful, the function will return the previous mode of the
given FILE.  In case of failure, -1 is returned and ERRNO is set.

Example
-------

     setmode(0, O_BINARY);


See Also: __djgpp_set_ctrl_c fflush

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