filestream?

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?
 
J

Joseph Bittman MVP MCSD

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top