Re: Open, Close, & Freefile
- From: dpb <none@xxxxxxx>
- Date: Tue, 10 Jul 2007 12:20:33 -0500
LurfysMa wrote:
On Tue, 10 Jul 2007 15:30:47 +1000, "Michael C" <nospam@xxxxxxxxxx>....
wrote:
"LurfysMa" <invalid@xxxxxxxxxxxxxxx> wrote in message news:i736931vqdsdfpa5ujbm3l2q3t9ovdoi6p@xxxxxxxxxxCan someone please confirm that my understanding of the use of Open,
Close, & Freefile is correct?
3. The Print statement writes the data "as is", whereas the WriteNot sure about this one but sounds correct. You'd need to try it.
statement adds characters such as quotes around string data.
Write #fnum, "This is some text..."
xx = "This is some text..."
Write #fnum, xx
VB writes out the quotes whether a literal or in a variable.
I tried it and I eventually found it in the help. It does it so that
when you read it back it, it's a literal.
Don't know why it should have to have been "eventually", it's in the section describing the Write # Statement... :)
"Unlike the Print # statement, the Write # statement inserts commas between items and quotation marks around strings as they are written to the file. You don't have to put explicit delimiters in the list."
Earlier in the description it also says "Data written with Write # is usually read from a file with Input #." and under Input # one finds--
"Note To be able to correctly read data from a file into variables using Input #, use the Write # statement instead of the Print # statement to write the data to the files. Using Write # ensures each separate data field is properly delimited."
As a side note, the "#" on the file number is consistent w/ the history of BASIC and as someone else noted, is required to remove ambiguity in some circumstances. The use is, in general, good practice simply for consistency and ease of reading source later whether it can be dispensed with in a particular instance or not. That, of course, comes w/ the "imo, ymmv, $0.02, etc., ..." caveat. :)
It is imo on the same line as using the trailing "$" on string intrinsics to ensure the character version is returned as opposed to Variant when that is what is intended, etc., ...
--
--
.
- References:
- Open, Close, & Freefile
- From: LurfysMa
- Re: Open, Close, & Freefile
- From: Michael C
- Re: Open, Close, & Freefile
- From: LurfysMa
- Open, Close, & Freefile
- Prev by Date: Re: Variable Open statement?
- Next by Date: Load animation control from resource?
- Previous by thread: Re: Open, Close, & Freefile
- Next by thread: Re: Open, Close, & Freefile
- Index(es):
Relevant Pages
|