ILE C/C++ Programmer's Guide


File Control Structure of Text Streams and Binary Streams

Both text streams and binary streams map to records in iSeries Data Management files. They can be processed one character at a time or one record at a time.

Figure 83. iSeries Data Management Records Mapping to an ILE C Stream File




Each text stream file and each binary stream file is represented by a file control structure of type FILE. This structure is defined in the <stdio.h> header file.

Attention: Unpredictable results may occur if you attempt to change the file control structure.


Table 8. Comparison of iSeries Data Management Text Streams and Binary Stream File Processing


Text Streams Binary Streams
Definition An ordered sequence of characters that are composed of lines. Each line consists of zero or more characters and ends with a new-line character. A sequence of characters that has a one-to-one correspondence with the characters stored in the associated iSeries Data Management file. On the iSeries system, the length of a binary stream file is a multiple of the record length.
Impact of I/O Processing The iSeries Data Management system may add, alter, or delete some special characters during input or output. Therefore, there may not be a one-to-one correspondence between the characters written to a text stream and characters read from the same text stream. Data read from a text stream is equal to data written to the text stream if all of the following are true:
  • The data consists of printable characters, horizontal tab, vertical tab, new-line character, or form-feed control characters.
  • No new-line character is immediately preceded by a space (blank) character.
  • The last character in a stream is a new-line character.
  • The lines that are written to a file do not exceed the record length of the file.
Character translation is not performed on binary streams. When data is written to a binary stream, it is the same when it is read back later.
Note:
New-line characters have no special significance in a binary stream.
End-of-File Processing When a file is closed, an implicit new-line character is appended to the end of the file unless a new-line character is already specified. When a file is closed, the last record in the file is padded with nulls (hexadecimal value 0x00) to the end of the record.


[ Top of Page | Previous Page | Next Page | Table of Contents ]