By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,769 Members | 1,625 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,769 IT Pros & Developers. It's quick & easy.


P: n/a
IO open a file steream for reading , but i want this file
to be changed by other application .
I trying the following line code to open it for reading
only :

FileStream Headerfp = new FileStream

but now i can't write to this file from other
application , How to open this file for read only and to
be able to write to this file by other application
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
>FileStream Headerfp = new FileStream

The third parameter in this particular overload of the FileStream
constructor is how your program is allowed to access the underlying

What you need is the following:

FileStream Headerfp = new FileStream(path, FileMode.Open,
System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);

This is an overload of the FileStream constructor which also accepts a
parameter called FileShare which determines how the file will be
shared by other processes.

See also:

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.