|
-
Jun 30th, 2005, 11:58 AM
#1
Thread Starter
Junior Member
StreamReader/StreamWriter
Hi,
I was wondering if I could get some help with IO.StreamReader and IO.StreamWriter. I have looked at a few examples and tried a few different ways but cannot seem to get these to work.
I am trying to write/append from one file to another. Source to Master.
Here is some info for the sake of an example.
Locations:
C:\ScanData\source.txt
C:\ScanData\Master.txt
Data:
Data is scanned into a text file, so each scan is placed on a new line. Depending on time of day, there could be a few to very many lines on the source.txt that I need transferred over to Master.txt.(once transfer takes place..source is deleted to make room for another source.txt later on)
This seems to be where my problem is..getting all the lines from source to master..the code runs through without error..but nothing happens as far as writing.
Any help would be appreciated.
Thanks
-
Jun 30th, 2005, 12:04 PM
#2
Hyperactive Member
Re: StreamReader/StreamWriter
If you want all lines appended form source to destination, try this:
VB Code:
' Read in the whole file
Dim Source As New System.IO.StreamReader("C:\source.txt")
Dim temp As String
temp = Source.ReadToEnd()
Source.Close()
' Append to destination
Dim Destination As StreamWriter
Destination = System.IO.File.AppendText("C:\destination.txt")
Destination.WriteLine(temp)
Destination.Close()
-
Jun 30th, 2005, 12:04 PM
#3
Fanatic Member
Re: StreamReader/StreamWriter
How about posting some code?
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Jun 30th, 2005, 12:59 PM
#4
Thread Starter
Junior Member
Re: StreamReader/StreamWriter
Awesome. That's what I needed. Thanks very much.
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
|