Reading from files

You can use the following library functions to read information from memory files; see z/OS XL C/C++ Runtime Library Reference for more information on these library functions.

The gets(), getchar(), scanf(), and vscanf() functions read from stdin, which can be redirected to a memory or hiperspace memory file.

You can open an existing file for read one or more times, even if it is already open for write. You cannot open a file for write if it is already open (for either read or write). If you want to update or truncate a file or append to a file that is already open for reading, you must first close all the other streams that refer to that file.

For memory files, a read operation directly after a write operation without an intervening call to fflush(), fsetpos(), fseek(), or rewind() fails. z/OS® XL C/C++ treats the following as read operations:

You can set up a SIGIOERR handler to catch read or write system errors that happen when you are using hiperspace memory files. See Debugging I/O programs for more information.