MPIO v1.4.0
file.h File Reference

Common file functions. More...

#include <stdio.h>

Macros

#define seekFile(file, offset, origin)   _fseeki64(file, offset, origin)
 Changes the current file position associated with stream to a new location within the file.
 
#define tellFile(file)   _ftelli64(file)
 Returns the file position indicator for the file stream stream.
 
#define closeFile(file)   fclose(file)
 Closes the given file stream.
 

Detailed Description

Common file functions.

Macro Definition Documentation

◆ seekFile

#define seekFile ( file,
offset,
origin )   _fseeki64(file, offset, origin)

Changes the current file position associated with stream to a new location within the file.

The origin must be one of the following constants defined in stdio.h

  • SEEK_SET - Beginning of file
  • SEEK_CUR - Current position of file pointer
  • SEEK_END - End of file
Parameters
[in]filefile stream to modify
offsetnumber of characters to shift the position relative to origin
originposition to which offset is added
Returns
​0​ upon success, nonzero value otherwise.

◆ tellFile

#define tellFile ( file)    _ftelli64(file)

Returns the file position indicator for the file stream stream.

If the stream is open in binary mode, the value obtained by this function is the number of bytes from the beginning of the file. If the stream is open in text mode, the value returned by this function is unspecified and is only meaningful as the input to fseek().

Parameters
[in]filefile stream to examine
Returns
File position indicator on success or -1L if failure occurs.

◆ closeFile

#define closeFile ( file)    fclose(file)

Closes the given file stream.

Any unwritten buffered data are flushed to the OS. Any unread buffered data are discarded. The behavior is undefined if the value of the pointer stream is used after fclose returns.

Parameters
[in]filethe file stream to close
Returns
​0​ on success, EOF otherwise.