Might be available but can't find a reference.
When I open a file it should by default accept
any file operations. So
open file "numbers.txt" for append
write 0 to file "numbers.txt"
close file "numbers.txt"
would be
open file "numbers.txt" for append
write 0
close file
This should be so even if other files are open.
Functionality like this was available in FoxPro2 (c. 1990)
Writing to a file
Moderator: Klaus
bjb007,
What if you need to read from and write to multiple files simultaneously? Then you need to make sure that you close the correct file. That's why it works this way in Rev.
Best,
Mark
What if you need to read from and write to multiple files simultaneously? Then you need to make sure that you close the correct file. That's why it works this way in Rev.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Writing to a file
Can't recall ever having to write to more than one
file at a time.
In FoxPro2 open files had an alias so referencing
an open file not the last opened (with alias "names") was
use names
write 33 (or append etc.)
use (to leave open) or close
This is probably a neat use of the #define command
which Rev "doesn't need" according to the docs.
file at a time.
In FoxPro2 open files had an alias so referencing
an open file not the last opened (with alias "names") was
use names
write 33 (or append etc.)
use (to leave open) or close
This is probably a neat use of the #define command
which Rev "doesn't need" according to the docs.
Hi bjb007,
I'm using lots of files all the time. Currently, I'm working on a database that can use dozens of files, which may or may open simultaneously.
It seems to me that xTalk and your beloved Fox Pro aren't so different with regard to reading from and writing to files in the sense that one needs to refer to a file before or while using it. (Obviously, xTalk and FP are very different with regard to very many other aspects).
I guess it is a matter of taste or maybe Bill Atkinson had a particular reason for doing it the way he did (I prefer to assume the latter).
Think of the following:
& Fox Pro pseudocode:
open file "File 1"
open file "File 2"
use "File 1"
read for 100
use "File 2"
write something
use "File 1"
close
use "File 2"
close
-- Transcript/MetaTalk:
open "File 1" for read
open "File 2" for write
read from file "File 1" for 100
write it to "File 2"
close file "File 1"
close file "File 2"
Of course, my Fox Pro example isn't "real", but I think that xTalk saves us a line, maybe two, for each file we are using, while the lines get a little longer than in Fox Pro.
A matter of taste after all. I don't think I care.
Best,
Mark
I'm using lots of files all the time. Currently, I'm working on a database that can use dozens of files, which may or may open simultaneously.
It seems to me that xTalk and your beloved Fox Pro aren't so different with regard to reading from and writing to files in the sense that one needs to refer to a file before or while using it. (Obviously, xTalk and FP are very different with regard to very many other aspects).
I guess it is a matter of taste or maybe Bill Atkinson had a particular reason for doing it the way he did (I prefer to assume the latter).
Think of the following:
& Fox Pro pseudocode:
open file "File 1"
open file "File 2"
use "File 1"
read for 100
use "File 2"
write something
use "File 1"
close
use "File 2"
close
-- Transcript/MetaTalk:
open "File 1" for read
open "File 2" for write
read from file "File 1" for 100
write it to "File 2"
close file "File 1"
close file "File 2"
Of course, my Fox Pro example isn't "real", but I think that xTalk saves us a line, maybe two, for each file we are using, while the lines get a little longer than in Fox Pro.
A matter of taste after all. I don't think I care.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode