ILE C/C++ Programmer's Guide

Using Stream I/O

The following sections describe stream I/O requirements for using:

Large Files

Within the C or C++ run-time environment, stream I/O for files up to two GB in size is enabled by specifying the *IFSIO option on the system interface keyword (SYSIFCOPT) on the Create Module or Create Bound Program command prompt.

When using the SYSIFCOPT keyword with either command, follow this format:


CRTCPPMOD MODULE(QTEMP/IFSIO) SRCFILE(QCPPLE/QACSRC) SYSIFCOPT(*IFSIO)
CRTBNDCPP PGM(QTEMP/IFSIO) SRCFILE(QCPPLE/QACSRC) SYSIFCOPT(*IFSIO)

When the *IFSIO option is specified, the compiler defines the __IFS_IO__ macro. When __IFS_IO__ is defined, prototypes associated with stream I/O in <stdio.h> are no longer defined. The header file <ifs.h> is included by <stdio.h>, which declares all structure and prototypes associated with the integrated file system enabled C stream I/O.

C language onlyThe 64-bit version of the Integrated File System interface lets you use ILE C stream I/O with files up to and greater than two gigabytes in size. (C++ stream I/O for files greater than two gigabytes is not supported.) To enable the 64-bit interface, specify the *IFS64IO option with the SYSIFCOPT keyword on the CRTCPPMOD or CRTBNDCPP command prompt. When this option is specified, the compiler defines the __IFS64_IO__ macro which, for example, remaps the open() function to an open64() function to allow 64-bit indexing..

Open Mode



The fstream(), ifstream(), and ofstream() classes have a new open mode ios::text, which opens the file in text mode.

By default, I/O streams are opened in binary mode (not in text mode, as stated in the Version 3 Release 7 books).

Line-End Characters

If you want to add carriage return (\r) characters, use the fopen() function with crln=Y (the default).


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