FUNCTION FChSize( ptrHandle AS IntPtr, dwOffset AS DWORD ) AS LOGIC
public static bool FChSize( IntPtr ptrHandle, uint dwOffset )
The low level File IO functions in the X# runtime are using .Net filestreams in the background. |
That means that the file handles returned by FOpen() and FCreate() are not 'normal' file handles, but unique identifiers that are used to find the underlying stream object in a collection of streams in the runtime.
That also means that you can't use file handles for functions such as FRead() and FWrite() that were not created in the X# runtime.
If you want to access the underlying FileStream, then you should call the function FGetStream(IntPtr)
1LOCAL hFile 2hFile := FOpen2("docs.txt", F0_READWRITE) 3IF hFile != F_ERROR 4 IF FChSize(hFile, 100) != F_ERROR 5 ? "Size successfully changed to 100" 6 ELSE 7 ? DOSErrString(FError()) 8 ENDIF 9ENDIF