Text editting in Vb.net, help.

  • Thread starter Thread starter Joshua Nunn
  • Start date Start date
J

Joshua Nunn

I am reading in a text file of about 25 megs, using a streamreader
class. Now this text file was generated using a DataBUS programming
language, now known as PL/B, and being used as a database, that just
happens to be a flat text file. What I need to be able to do is to read
in a line from this text file, edit a few fields in this text stream
(which I can do), and then write the editted line back out at the same
formpointer position. I can do this easily by writing out to a seperate
file, but I'm hoping to write back out to the same file to prevent
dataloss. Any suggestions on how to use streamreader to read in a line
and then overwrite the previous line with the editted line at the same
form pointer position? Should I even be using the streamreader/writer
class, or should I be using the filestream class? Please help, I'm
lost..:(


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Read up on the BinaryReader and BinaryWriter classes.
You can open a Filestream (as you've done) then use the BinaryReader to read
a part of the file, then obviously the BinaryWriter to write data back to
the file. I only remember this because I did it today - and I know that
with the Binary classes you use Seek to move to any position within the
file. I'm not sure if you can do the same with the Filestream or
Textstream - Seek could be a function of the BaseStream - if you can it's
your preference.
_________________________________
The Grim Reaper
 
Thanks dude, your a genius. Actually, the basestream method of the
streamreader/streamwriter classes actually allows you to access every
method (atleast at a glance) that you can normally access with a
filestream, which gives me position and seek, which works for my uses.
I appreciate the help.

--Josh

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
:O Genius?? :O You jest :D

My IQ's only 147 according to Mensa :D :))
_____________________________
The Grim Reaper
 
Back
Top