Re: Checking the existence of a file

From: silverdr_at_wfmh.org.pl
Date: Tue, 1 Mar 2016 15:37:36 +0100
Message-Id: <1490D696-90C0-42C6-9A70-A398F852C6F7@wfmh.org.pl>
> On 2016-03-01, at 14:26, Baltissen, GJPAA (Ruud) <ruud.baltissen@apg.nl> wrote:
> 
> Hallo allemaal,
>  
>  
> Although I have written a lot in ML, I cannot remember to have written a PRG in ML for any Commodore ever. My problem: how can I check the existence of a file? As shown in a Data-Becker book I did set various variables like filename and the length of it using a standard routine, set the logical file number, device number and secondary address using a standard routine and called the OPEN routine. This Data-Becker book said that if things go wrong, the Carry is set and A contains the error code, including one for 'file is missing'. Seemed simple enough.
>  
> I tested the routine by entering a non-existing name but after OPEN the Carry is clear (thus file exists IMHO),

AFAIR OPEN() doesn't do anything except assigning the entry in the LAT table and checking the presence of the device. It would return error in cases like when it couldn't assign the table entry (too many open files, device not present, etc.).

It doesn't check the actual existence of the file you try to OPEN() so it won't report this correctly back to you. I recall doing the very same thing a few you try to do now many times times but I need to fetch my sources to recall how I eventually did it in a simple and reliable way.

-- 
SD!


       Message was sent through the cbm-hackers mailing list
Received on 2016-03-01 15:02:18

Archive generated by hypermail 2.2.0.