Borland C++ reference

setmode

raw OCR

Sets mode of an open file.

Defined in header <fcntl.h>

Syntax

#include <fcntl.h>
int setmode(int handle, int amode);

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

setmode sets the mode of the open file associated with handle to either binary or text. The argument amode must have a value of either

OBINARYor O_TEXT, never both. (These symbolic constants are defined

in fcntl.h.)

Return value

setmode returns the previous translation mode if successful. On error it returns -1 and sets the global variable errno to

EINVAL Invalid argument

See also

Example

#inc.lude <stdio.h>
#include <fcntl.h>
#include <io.h>

int main (void)
{
   int result;
   result - setmode (fileno(stdprn), 0_TEXT) ;
   if  (result == -1)
      perror("Mode  not available\n") ;
   else
      printfC'Mode  successfully switched\n" );
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.