ILE C/C++ Programmer's Guide
To open an iSeries Data Management file as a binary stream file for
character-at-a-time processing, use fopen() with any of the
following modes:
- rb
- r+b
- rb+
- wb
- w+b
- wb+
- ab
- a+b
- ab+
Notes:
- The number of files that can be simultaneously opened by
fopen() depends on the size of the system storage available.
- The fopen() function open modes also apply to the
freopen() function.
- If the binary stream file contains deleted records, the deleted records
are skipped by the binary stream I/O functions.
The valid keyword parameters are:
- blksize
- lrecl
- recfm
- type
- commit
- ccsid
- arrseq
- indicators
If you specify the type parameter the value must be memory for
binary stream character-at-a-time processing.
- Note:
- The memory parameter identifies this file as a memory file that is
accessible only from C programs. This parameter is the default and is
ignored.
If you specify a mode or keyword parameter that is not valid on
fopen(), errno is set to EBADMODE.
Example:
The following example illustrates how to open a binary stream file.
Figure 89. ILE C Source to Open a Binary Stream File
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *fp;
/* Open an existing binary file. */
if (( fp = fopen ( "MYLIB/TEST(MBR)", "wb+" ) ) == NULL )
{
printf ( "Cannot open file\n" );
exit ( 1 );
}
printf ("Opened the file successfully\n");
/* Perform some I/O operations. */
fprintf (fp, "Hello, world");
fclose ( fp );
return 0;
}
|
- Note:
- You can read, write to, or update any binary stream files that are
open for character-at-a time processing.

To open an iSeries Data Management file as a binary stream file for
character-at-a-time processing, use the open() member function with
ios::binary as well as any of 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.