C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)

Table 10 Buffer Sizes (continued)
Maximum Length of Buffer in BytesFile Type
4096C file accessed as binary-type logical file
256Process accessed as text-type logical file
32,767Process accessed as binary-type logical file
32,767$RECEIVE
Physical File Types
As mentioned earlier, the C run-time library provides input and output access to several types of
physical files, including C files, EDIT files, processes, and terminals. These subsections describe
these physical file types and specify which logical types you can use to access each of the physical
types.
C Files
C files are odd-unstructured disk files with a file code of 180 when stored in the Guardian file
system. Because C files are odd-unstructured (rather than simply unstructured), they are
byte-addressable; that is, you can read, write, and position to single bytes instead of words.
When accessing a C file, use either the text or the binary logical type.
Opening a C file as a text file causes subsequent writes and reads to transfer the exact number of
characters specified, including trailing blanks.
Edit Files
When accessing an EDIT file, you must use the text logical type. Due to their physical structure,
EDIT files are only line-addressable. Consequently, an error occurs if you attempt to disable line
buffering of an EDIT file.
Because EDIT files do not physically contain newline characters, the run-time library automatically
adds them on input and removes them on output. This addition of newlines makes the EDIT file
truly accessible as a text file.
It is a standard feature of EDIT files that trailing blanks are stripped from each line.
Processes
When accessing a process, use either the binary or the text logical type.
When you characterize a process as a binary file, each I/O request is an interprocess message.
Consequently, when you perform binary interprocess communication, you should use the direct
I/O functions that transfer blocks of data, not single characters.
When you characterize a process as a text file, each line is an interprocess message. Because
these messages do not physically contain newline characters, the run-time library automatically
adds them on input and removes them on output.
Terminals
When accessing a terminal, use either the text or the binary logical type.
When you characterize a terminal as a text file, data is normally line-buffered. As a result, input
from the terminal is not available until the terminal user presses the Return key.
When you characterize a terminal as a binary file, no buffering occurs.
If you open a terminal for alternate-model I/O as a binary file, an ambiguity arises when you read
an empty line because the return value is zero (which normally indicates the end of the line). In
this case, the alternate-model I/O functions set errno to the value 1 to indicate the end of the file.
Input/Output Models 73