Click or drag to resize

FRewind Function

X#
Set the file pointer at the top of an open file.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION FRewind(
	ptrHandle AS IntPtr
) AS LOGIC
Request Example View Source

Parameters

ptrHandle
Type: IntPtr
The handle of the open file.

Return Value

Type: Logic
Remarks
FRewind() sets the file pointer to the beginning of a file.
It is the same as issuing an FSeek() to go to the top-of-file.
Remarks
Tip Tip
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)
Examples
This example uses FRewind() to go back to the top-of-file:
X#
1hF := Fopen2("c:\vo.txt", FO_READ)
2FSeek(hF, 10, FS_SET)        // Move by 10 bytes
3FRewind(hF)                    // Move back to the top
See Also