Oxygen Basic
Programming => Problems & Solutions => Topic started by: Peter on July 26, 2011, 06:18:53 AM
-
Hi Charles,
(string File) is an error, an evil error of the programmer.
Sub SaveFile(Byval File as string,byref dest as any, byval count as long) 'saves lovely
sys FileHandle
FileHandle = CreateFile(File, GENERIC_WRITE, FILE_SHARE_WRITE, BYVAL 0, OPEN_ALWAYS, 0, 0)
WriteFile FileHandle,dest,count,&dwcount, Byval 0
CloseHandle FileHandle
End Sub
Sub SaveFile(string File, byref dest as any, byval count as long) 'does not save
sys FileHandle
FileHandle = CreateFile(File, GENERIC_WRITE, FILE_SHARE_WRITE, BYVAL 0, OPEN_ALWAYS, 0, 0)
WriteFile FileHandle,dest,count,&dwcount, Byval 0
CloseHandle FileHandle
End Sub
-
Hi Peter,
this puzzled me for some time but the problem is that the wrong SaveFile function gets called. Consequently the string parameter has the wrong indirection level.
When the two functions have different names, there is no confusion and each works correctly.
But Oxygen should be able to cope with this situation. I will need to dig in further.
Charles