Author Topic: String Error  (Read 2351 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
String Error
« 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

Charles Pegge

  • Guest
Re: String Error
« Reply #1 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