File Problem

 

In a script I:

Open a binary file [ fHandle = FileOpen( FileName, FILE_BIN | FILE_WRITE ) ],
write several strings [ FileWriteString( fHandle, string ), several times ] and
close the file [ FileClose( fHandle ) ].

I get a message "handle 1 does not exist in FileClose". The file has been written perfectly.

When I move the identical code into an Expert where the code is executed but the Expert continues executing I get the same "handle 1 does not ..." message but the file is inaccessible. The file remains inaccessible until the Expert is terminatede (Removed).

I get the same message for FileFlush.

Any suggestions?

Thanks

RVR



 
Aren't you supposed to supply the length of the string?
 
irusoh1 wrote:
Aren't you supposed to supply the length of the string?
Sorry. I did have the string length in the . Point is that the file is perfect but the FileClose operation shows an error and the Expert does not release the file (I can look at it but I can not, for example, delete it.)

Thanks
 
File should be closed in the same module in wich were opened before. File handle cannot be passed into imported librarian function.
 
stringo wrote:
File should be closed in the same module in wich were opened before. File handle cannot be passed into imported librarian function.
Thanks for that. I missed it in the documentation. Cheers.