Hi Peter,
Fixed the indirection problems
IndexBase 0
Declare Function ReadFile Lib "kernel32.dll" (ByVal hFile As Long, ByRef lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, ByRef lpNumberOfBytesRead As Long, ByRef lpOverlapped As OVERLAPPED) As Long
Declare Function WriteFile Lib "kernel32.dll" (ByVal hFile As Long, ByRef lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, ByRef lpNumberOfBytesWritten As Long, ByRef lpOverlapped As OVERLAPPED) As Long
Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Long sys_count
Function LoadFile(byval file as string,byval dest as long,byval count as long) as long
Long fHandle,dst
dst = dest
push 0
push 128
push 4
push 0
push 1
push &h80000000
push file
call CreateFile
mov fHandle,eax
Function = fHandle
push 0
lea eax,sys_count
push eax
push count
push dest
push fHandle
call ReadFile
push fHandle
call CloseHandle
End Function
Function SaveFile(byval file as string,byval dest as long,byval count as long) as long
Long fHandle
push 0
push 128
push 4
push 0
push 2
push &h40000000
push file
call CreateFile
mov fHandle,eax
Function = fHandle
push 0
lea eax,sys_count
push eax
push count
push dest
push fHandle
call WriteFile
push fHandle
call CloseHandle
End Function
long x
string s1,s2,s3
Dim p(6) as byte
Dim m(6) as byte
For x=1 to 5
m(x) =x
next
s1 ="HELLO MAMA"
s2 =" "
s3 =" "
SaveFile "number.txt",&m,6
SaveFile "Mama.txt",*s1,Len(s1)
LoadFile "number.txt",&p,6
For x=1 To 5
print p(x)
next
LoadFile "Mama.txt",*s2,Len(s2)
print s2
LoadFile "Mama.txt",*s3,Len(s3)
print s3 + " HUHU"
Charles