Jump to content

DosSetFileSizeL: Difference between revisions

From EDM2
Ak120 (talk | contribs)
m was total garbage
Ak120 (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


==Syntax==
==Syntax==
 
DosSetFileSizeL (hFile, cbSize)
APIRET DosSetFileSizeL (HFILE hFile, LONGLONG cbSize)
</PRE>


==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
;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 NO_ERROR
* 6 ERROR_INVALID_HANDLE
*   ERROR_ACCESS_DENIED
*26 ERROR_NOT_DOS_DISK
*   ERROR_INVALID_HANDLE
*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==

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.

Related Functions