Login | |
|
 |
RE: ForAppending & ForWriting - 5/22/2007 7:25:45 PM
|
|
 |
|
| |
ginolard
Posts: 1082
Score: 21
Joined: 8/10/2005
Status: offline
|
ForReading opens a file for reading (i.e. you can't write to it) ForWriting either opens an existing file in write mode (overwriting it if it's already there) or creating a new file for writing if it doesn't exist. You also have ForAppending (value of 8) which will open an existing file for writing and lets you append text to the end of the file
_____________________________
Author of ManagePC - http://managepc.net AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm
|
|
| |
|
|
|
 |
RE: ForAppending & ForWriting - 5/22/2007 8:14:43 PM
|
|
 |
|
| |
ginolard
Posts: 1082
Score: 21
Joined: 8/10/2005
Status: offline
|
Ahem, yes, not awake. Still, my post did answer your question. ForWriting will either a) Open an existing text file for writing and will overwrite it (i.e. any existing content will be lost) b) Create a new file for writing if it doesn't already exist ForAppending will open an existing for writing and allow you to add text to whatever is already there.
_____________________________
Author of ManagePC - http://managepc.net AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm
|
|
| |
|
|
|
 |
RE: ForAppending & ForWriting - 5/23/2007 1:17:12 AM
|
|
 |
|
| |
DiGiTAL.SkReAM
Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
|
Since I come from a background of batch files, it is always easiest for me to think of them this way. ForAppending is the same as doing this in a batch file: dir c: >> d:\output.txt while ForWriting is the same as doing this in a batch file: dir c: > d:\output.txt
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers) "It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
|
|
| |
|
|
|
 |
RE: ForAppending & ForWriting - 5/23/2007 2:04:13 AM
|
|
 |
|
| |
mcds99
Posts: 441
Score: 4
Joined: 2/28/2006
Status: offline
|
When you append you add to any existing content, writting occurs after the last existing line. When you write you overwrite any existing content, writting occurs at line 1 character 1.
_____________________________
Sam Keep it Simple Make it Fun KiSMiF
|
|
| |
|
|
|
|
|