filestream?

  • Thread starter Thread starter cj
  • Start date Start date
C

cj

VB2005

I've opened files and read them using

r = new io.streamreader("c:\thisfile.txt")
line = r.readline

Now I see an example where they are doing
dim objopenfile as io.filestream = new io.filestream(filename,
io.filemode.open, io.fileaccess.read, io.fileshare.read)
dim objstreamreader as io.streamreader = new io.streamreader(objopenfile)
textbox1.text=objstreamreader.readtoend()

What is filestream and why would I want to use it?
 
Sept. 13, 2006

Creating a new streamreader and providing a file name just creates a new
stream to the file. If you create a filestream yourself and then pass it to
the streamreader, you will get more options... like whether to only open the
file for Reading, or only for Writing.

At times, your user account may only have Read or Write NTFS privileges to a
file... and opening a stream directly through a reader/writer may demand
both privileges because it doesn't know what you will be doing.

Just a matter of options... I don't think there's probably a performance
difference.

--

Joseph Bittman
Microsoft Certified Solution Developer
Microsoft Most Valuable Professional -- DPM

Blog/Web Site: http://CactiDevelopers.ResDev.Net/
 
Back
Top