
PT-20 Programming Guide
Use _fcloseAll to close all files opened for buffered input/output with _fopen
or tmpfile.
The _fcloseAll function closes all files that have been opened by _fopen or
tmpfile for buffered I/O. Buffers associated with files opened for writing are
written out to the corresponding file before closing.
Use _filelength to dertimine the length of a file in bytes.
size_t _filelength(_TFILE* file_pointer);
file_size = _filelength(infile);
The _filelength function returns the size in number of bytes of the file
specified in the argument file_pointer. This pointer should be the return
value of earlier opened file by _fopen.
The integer value returned by _filelength is the size of the file in number of
bytes.
Use _fopen to open a file for buffered input/output operations.
_TFILE* _fopen(const char*filename, const char *access_mode);
input_file = _fopen("c:\\data\\order.dat", "r");
The fopen function opens the file specified in the argument filename. The
type of operations you intend to perform on the file must be given in the
argument access_mode. The following table explains the values that the
access_mode string can take:
Opens file for read operations only. The _fopen function
fails if the file does not exist.
Opens a new file for writing. If the file exists, its contents
are destroyed.
Opens an existing file for both read and write
operations. Error is returned if file does not exist.
Komentarze do niniejszej Instrukcji