04-16-2017, 03:46 AM
To be more precise, I am seeing this with
which is a useful way to test for the existence of a file. This seems to be the only variation of OPEN that does not require a stream number. But it still requires the stream to be closed afterwards.
I suppose you could use SYSTEM("test -e " + pathname$) but the less we need to shell out, the better
If I've been careful with my streams, it will grab the first available one, normally #1, and CLOSE#1 will get rid of it. But If you have not been careful, well ...
BTW, when I was writing "Programming with yab", I noticed that our documentation does not explicitly mention how many streams are available, so I started increasing the number until I got an error. I was expecting 9, like in QuickBasic. In fact, it is 124. How insane is that? I'd really hate to maintain the program that had 124 files open.
Code:
IF OPEN(pathname$, "r") THEN ...
which is a useful way to test for the existence of a file. This seems to be the only variation of OPEN that does not require a stream number. But it still requires the stream to be closed afterwards.
I suppose you could use SYSTEM("test -e " + pathname$) but the less we need to shell out, the better
If I've been careful with my streams, it will grab the first available one, normally #1, and CLOSE#1 will get rid of it. But If you have not been careful, well ...
BTW, when I was writing "Programming with yab", I noticed that our documentation does not explicitly mention how many streams are available, so I started increasing the number until I got an error. I was expecting 9, like in QuickBasic. In fact, it is 124. How insane is that? I'd really hate to maintain the program that had 124 files open.