vb question
There is actually several ways of doing this. The most common way is by using the File System Object containted in the MS Scripting DLL - check the MSDN for more details.
Otherwise the most simplest form is by calling the kill() function to delete files and to create them use
I think thats how you do it from memory
Extracting Patch....
Initializing Windows XP Update Path 2543663B....
Core Dumped, Now Installing Linux.....
----
Mike
Team AI: Http://members.iinet.net.au/~slyons/teamai
[edited by - Mike737 on August 18, 2003 2:56:56 AM]
Otherwise the most simplest form is by calling the kill() function to delete files and to create them use
open "C:\mytextfile.txt" for output as #1close #1
I think thats how you do it from memory
Extracting Patch....
Initializing Windows XP Update Path 2543663B....
Core Dumped, Now Installing Linux.....
----
Mike
Team AI: Http://members.iinet.net.au/~slyons/teamai
[edited by - Mike737 on August 18, 2003 2:56:56 AM]
You should never hard-code the file handle. Try:
Dim iFile As Integer
iFile = FreeFile
Substitute iFile for the two places where the handle is hard-coded. The FreeFile function ensure you get a valid handle.
Dim iFile As Integer
iFile = FreeFile
Substitute iFile for the two places where the handle is hard-coded. The FreeFile function ensure you get a valid handle.
Yeah... here''s the basics:
to Write to a file:
ff=FreeFile
Open "C:\happy.abc" for output as ff
Write ff, StringThatIWantToWrite
Close ff
to Read a file(note, this only works for the 1st line, cant remember how to read the entire file without repeating the Input line):
ff=FreeFile
Open "C:\happy.abc" for input as ff
Input ff, StringThatIWantToFill
Close ff
And alas, to destroy a file:
Kill "C:\happy.abc"
to Write to a file:
ff=FreeFile
Open "C:\happy.abc" for output as ff
Write ff, StringThatIWantToWrite
Close ff
to Read a file(note, this only works for the 1st line, cant remember how to read the entire file without repeating the Input line):
ff=FreeFile
Open "C:\happy.abc" for input as ff
Input ff, StringThatIWantToFill
Close ff
And alas, to destroy a file:
Kill "C:\happy.abc"
Yeah... here''s the basics:
to Write to a file:
ff=FreeFile
Open "C:\happy.abc" for output as ff
Write ff, StringThatIWantToWrite
Close ff
to Read a file(note, this only works for the 1st line, cant remember how to read the entire file without repeating the Input line):
ff=FreeFile
Open "C:\happy.abc" for input as ff
Input ff, StringThatIWantToFill
Close ff
And alas, to destroy a file:
Kill "C:\happy.abc"
to Write to a file:
ff=FreeFile
Open "C:\happy.abc" for output as ff
Write ff, StringThatIWantToWrite
Close ff
to Read a file(note, this only works for the 1st line, cant remember how to read the entire file without repeating the Input line):
ff=FreeFile
Open "C:\happy.abc" for input as ff
Input ff, StringThatIWantToFill
Close ff
And alas, to destroy a file:
Kill "C:\happy.abc"
To read in a file to an array you might use this:
(Modifying Quantum''s code)
ff=FreeFile
Open "C:\happy.abc" for input as ff
While NOT EOF(ff)
Redim Preserve myArray(j)
Input ff, myArray(j)
j=j+1
Wend
Close ff
(Modifying Quantum''s code)
ff=FreeFile
Open "C:\happy.abc" for input as ff
While NOT EOF(ff)
Redim Preserve myArray(j)
Input ff, myArray(j)
j=j+1
Wend
Close ff
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement