|
-
July 14th, 1999, 04:18 PM
#1
Text files reading and writing
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 [email protected]
-
July 15th, 1999, 01:44 AM
#2
Re: Text files reading and writing
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
-
July 15th, 1999, 10:07 AM
#3
Re: Text files reading and writing
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|