How can I make a stream appendable and readable at the same time?
Because when I do this:

static FileStream fs = File.Open("keys.txt", FileMode.Append, FileAccess.ReadWrite, FileShare.None);

I get the following error:
"Append access can be requested only in write-only mode."

why what is the problem?

Because the replies are irrelevant. I don't see appending being mentioned anywhere, the replies only show how to open a file for read/write access.

comon man read it properly
theFS = new FileStream(theFileName, FileMode.Open,
FileAccess.Read, FileShare.Read);

comon man read it properly
theFS = new FileStream(theFileName, FileMode.Open,
FileAccess.Read, FileShare.Read);

Yes, that's how I'm reading it. What's your point?

OK, in C++ you can use the function fopen and specify the second paramater as "a+" which means that you can open the file for both appending and reading. Now I've tried all sorts of stream combinations in C# with different FileAccess and FileModes and all that nonsense but I can't get it to append and read a file without being rewarded with some sort of error. I'm working on two different threads and I want the first one to be able to append when it wants and the second to read when it wants. That's all!

Never mind, I fixed it.

I was using:

static FileStream fw = File.Open("test.txt", FileMode.Append, FileAccess.Write, FileShare.Read);
static StreamWriter sw = new StreamWriter(fw);
static FileStream fr = new FileStream("test.txt", FileMode.Open, FileAccess.Read);
static StreamReader sr = new StreamReader(fr);

but I needed to use:

static FileStream fw = File.Open("test.txt", FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
static StreamWriter sw = new StreamWriter(fw);
static FileStream fr = new FileStream("test.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
static StreamReader sr = new StreamReader(fr);

UM? which version of MS Access and C# are you using?

MS Access? What's that have to do with anything?
Anyways I'm using Visual Studio 2010 (C# 4.0).

This question has already been answered. Start a new discussion instead.