Chris,
Note hf is the file handle (a pointer), and fd is the file descriptor index, which you may be more accustomed with.
'2018-03-13 T 07:47:19
'random access read/write
'https://docs.microsoft.com/en-gb/cpp/c-runtime-library/file-handling
'
$filename "t.exe"
'uses rtl64
uses corewin
'
'EXAMPLE RECORD
type xyzlabel
single x,y,z
wchar s[64]
end type
'
sys hf
int le
dim xyzlabel ww
'
'PUT SOME DATA INTO RECORD
ww={ 1.5 , 2.5 , 3.5 , "labelled point in space" }
hf=fopen "t.txt","w" 'CREATING / WRITING
if hf
int fd=_fileno hf
'print _filelength fd
fseek hf,sizeof(ww)*10,0 'POSITION 11TH RECORD
le=fwrite @ww,sizeof ww,1,hf
fclose hf
print "written: " ww.x " , " ww.y " , " ww.z " " ww.s
end if
'
'
dim xyzlabel rr 'BLANK RECORD TO RECEIVE DATA
'
hf=fopen "t.txt","r+" 'READING AND WRITING
if hf
int fd=_fileno hf
'a=_SetMode fd,0x8000 '_o_binary default
print _filelength fd
fseek hf,sizeof(rr)*10,0 '11TH RECORD IN FILE
le=fread @rr,sizeof rr, 1, hf
fclose hf
print "read " rr.x " , " rr.y " , " rr.z " " rr.s
end if