DosSetFileSizeL

From EDM2
Jump to: navigation, search

DosSetFileSizeL changes the size of a file.

Syntax

DosSetFileSizeL (hFile, cbSize)

Parameters

hFile (HFILE) input
The handle of the file whose size to be changed.
cbSize (LONGLONG) input
The new size, in bytes, of the file.

Return Code

ulrc (APIRET) returns
DosSetFileSizeL returns one of the following values:
  • 0 NO_ERROR
  • 5 ERROR_ACCESS_DENIED
  • 6 ERROR_INVALID_HANDLE
  • 26 ERROR_NOT_DOS_DISK
  • 33 ERROR_LOCK_VIOLATION
  • 87 ERROR_INVALID_PARAMETER
  • 112 ERROR_DISK_FULL

Remarks

When DosSetFileSizeL is issued, the file must be open in a mode that allows write access.

The size of the open file can be truncated or extended. If the file size is being extended, the file system tries to allocate additional bytes in a contiguous (or nearly contiguous) space on the medium. The values of the new bytes are undefined.

Example Code

This example writes to a file named DOSMAN.DAT, resets the buffer, and changes the file size.

Related Functions