Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

POSIX-IO macros

&pagelevel(3)&pagelevel

For functions in the C library that work with data, you must determine if the file is a POSIX file system file or a BS2000 file before executing the actual function. If you already know that you will only be working with files from the POSIX file system, then you can save yourself the effort and obtain better performance in doing so. For the following macros CRTE contains a special version of the macro for working with files in the POSIX file

system:

getc (p):

read characters from a file

getchar():

read characters from standard input

putc(x, p):

putchar(x)

write characters to file

write characters to standard output

clearerr (p):

clear end-of-file and error flags

feof(p):

test for end-of-file

ferror(p):

test for file error

fileno(p):

get file descriptor

The macros are still stored in the <stdio.h> header as before. In order to generate the POSIX variant, the user must set the __POSIX_MACROS define before the <stdio.h> header file is included.