An anomaly in the "read from file" command?

Quentin Long cubist at aol.com
Wed Apr 26 02:35:53 EDT 2017


First off, thanks to Alan Stenhouse for zeroing in on my filter-related mistake. Any number fo people *could* have done so, but it was Alan who actually did the deed. So, yay Alan!

Second: I discovered something odd as a result of another mistake I made. My mistake:

ask file "What do you want to read?"
put it into DisFile
read from file DisFile until EOF
put it into fld "This Field"

What went into field "This Field" was the contents of the *variable* DisFile, *not* the contents of the *file* whose name is stored in the variable DisFile. This is because of how the pseudo-variable "it" behaves, i suspect.

My mistake was that I didn't *open* file DisFile before reading it, of course. And once I did open the file, the reading went on normally, and the contents of the field did indeed end up in the field "This Field". So, bad on me for not opening the file first, good on me for recognizing & fixing that lapse without external assistance. But I do have a question:

Why didn't I get an error message when I tried to read from a file that hadn't been opened yet? Shouldn't LiveCode have gotten fussy about that? 

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
    
Read the webcomic at [ http://www.atarmslength.net ]!
    
If you like "At Arm's Length", support it at [ http://www.patreon.com/DarkwingDude ].




More information about the use-livecode mailing list