Oxygen Basic

Programming => Problems & Solutions => Topic started by: Peter on July 26, 2011, 06:18:53 AM

Title: String Error
Post by: Peter on July 26, 2011, 06:18:53 AM
Hi Charles,

(string File) is an error, an evil error of the programmer.

Code: [Select]
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
Title: Re: String Error
Post by: Charles Pegge on July 26, 2011, 02:14:33 PM

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