Click to See Complete Forum and Search --> : Text files reading and writing
July 14th, 1999, 04:18 PM
Has anyone got an idea/ code of how I can read a text file line by line, format each line by adding 'F' at the end of each line and writing it to another file, all in one procedure. I come from a C background and dont know VB...Please help
email me with an answer at Chyke@aol.com
Lothar Haensler
July 15th, 1999, 01:44 AM
dim hIn as integer
dim hOut as integer
hIn= freefile
open "inputfile" for input as #hIn
hOut = freefile
open "outputfile" for output as #hOut
dim strLine as string
do while not eof(hIn)
line input #hIn, strLine
print #hOut, strLine & "F"
Loop
close hIn
close hOut
replace the file names with parameters
DaveM
July 15th, 1999, 10:07 AM
Open one file for input and another for output (OPEN). Then use while not End of File (WHILE NOT EOF(fh))) to read in each line from the input file. Use LINE INPUT to read one full line. Then append the "F" using & operator. (sInLine & "F")
Then Print the resulting line to the output file.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.