ILE C/C++ Programmer's Guide
To open an iSeries system file as a text stream file, use fopen() with one of the following modes:
Notes:
- The number of files that can be simultaneously opened by
fopen() depends on the amount of the system storage
available.
- The fopen() function open modes also apply to the
freopen() function.
- If the text stream file contains deleted records, the deleted records are
skipped by the text stream I/O functions.
The valid keyword parameters are:
- lrecl
- ccsid
- recfm (F, FA, and FB only)
If you specify a mode or keyword parameter that is not valid on
fopen(), errno is set to EBADMODE, and NULL is returned.
Example:
The following example illustrates how to open a text stream file.
Library MYLIB must exist. The file TEST is created for you if it does
not exist. The mode w+ indicates that if MBR does not exist,
it is created for update. If it does exist, it is cleared.
Figure 84. ILE C Source to Open an ILE C Text Stream File
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *fp;
/* Open a text stream file. */
/* Check to see if it opened successfully */
if (( fp = fopen ( "MYLIB/TEST(MBR)", "w+") ) == NULL )
{
printf ( "Cannot open MYLIB/TEST(MBR)\n" );
exit ( 1 );
}
printf ( "Opened the file successfully\n" );
/* Perform some I/O operations. */
fclose ( fp );
return 0;
}
|
- Note:
- You can read, write to, or update any text stream file that is open
for processing.

To open an iSeries system file as a text stream file, use the
open() member function with the following modes:
- ios::app
- ios::ate
- ios::in
- ios::out
- ios::trunc
[ Top of Page | Previous Page | Next Page | Table of Contents ]
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.