DosSetFileSizeL: Difference between revisions
Appearance
m Ak120 moved page OS2 API:CPI:DosSetFileSizeL to DosSetFileSizeL |
mNo edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
DosSetFileSizeL changes the size of a file. | |||
DosSetFileSizeL changes the size of a file. | |||
==Syntax== | ==Syntax== | ||
DosSetFileSizeL (hFile, cbSize) | |||
==Parameters== | ==Parameters== | ||
; hFile HFILE) input : The handle of the file whose size to be changed. | ;hFile (HFILE) input: The handle of the file whose size to be changed. | ||
; cbSize LONGLONG) input : The new size, in bytes, of the file. | ;cbSize ([[LONGLONG]]) input: The new size, in bytes, of the file. | ||
==Return Code== | ==Return Code== | ||
;ulrc (APIRET) returns:DosSetFileSizeL returns one of the following values: | |||
* 0 NO_ERROR | |||
DosSetFileSizeL returns one of the following values: | * 5 ERROR_ACCESS_DENIED | ||
* 0 | * 6 ERROR_INVALID_HANDLE | ||
* | *26 ERROR_NOT_DOS_DISK | ||
* | *33 ERROR_LOCK_VIOLATION | ||
* 26 ERROR_NOT_DOS_DISK | *87 ERROR_INVALID_PARAMETER | ||
* 33 ERROR_LOCK_VIOLATION | *112 ERROR_DISK_FULL | ||
* 87 ERROR_INVALID_PARAMETER | |||
* 112 ERROR_DISK_FULL | |||
==Remarks== | ==Remarks== | ||
When DosSetFileSizeL is issued, the file must be open in a mode that allows write access. | 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. | 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== | ==Example Code== | ||
This example writes to a file named DOSMAN.DAT, resets the buffer, and changes the file size. | This example writes to a file named DOSMAN.DAT, resets the buffer, and changes the file size. | ||
==Related Functions== | ==Related Functions== |
Latest revision as of 16:23, 29 November 2018
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.