Returns a specified number of bytes from a file opened with FCreateEx or FOpenEx.
FReadEx(nFileHandle, nBytesToRead)
Parameters
- nFileHandle
Specifies the file handle number for the file from which FReadEx returns data. You can obtain nFileHandle from FOpenEx, FCreateEx or a windows api function.
- nBytesToRead
Specifies the number of bytes to return. FReadEx returns data starting from the current file pointer position and continues until it returns nBytesToRead bytes or until it encounters the end of the file.
Return Value
The data read from the file or an empty string if an error occured.
Remarks
You can NOT mix and match the native VFP file handle functions with the VFP2C32 functions, as the file handle created with one does not work with the other.
Example
Open a file and return the first 20 bytes:
LOCAL nFileHandle, cBytesRead nFileHandle=FOpenEx("c:\temp\audit.log") cBytesRead = FReadEx(nFileHandle, 20) ? cBytesRead && Returns 1st 20 bytes of the file, since the read position wasn't moved after FOpenEx()
See Also
Reference
AFHandlesEx
FChSizeEx
FCloseEx
FCreateEx
FEoFEx
FFlushEx
FGetsEx
FLockFile
FLockFileEx
FOpenEx
FPutsEx
FSeekEx
FUnlockFile
FUnlockFileEx
FWriteEx