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)
1hF := FOpen2("myfile.txt", FO_READWRITE) 2IF hF != F_ERROR 3 ? FTell(hF) // 0 4 FWrite3(hF, "Hello", 5) 5 ? FTell(hF) // 5 6 FSeek3(hF, 10, FS_SET) 7 ? FTell(hF) // 10 8ELSE 9 ? "Open failed" 10ENDIF