SetEndOfFile

  BOOL SetEndOfFile(hFile)    
  HANDLE hFile; /* handle of file whose EOF is to be set */

The SetEndOfFile function moves the end-of-file position for the specified file to the current position of the file pointer.

Parameters

hFile

Identifies the file that is to have its end-of-file position moved. The file handle must have been created with GENERIC_WRITE access to the file.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

This function can be used to truncate or extend a file. If the file is extended, the contents of the file between the old end of file position and the new position are not defined.

See Also

CreateFile