Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone!
i create a file.txt. i could write once in the file but when i am trying to read in the file just after the following line
using (StreamReader Sread = new StreamReader(Filestream))

i become an error: "Stream was not readable".

please how can i handle this error?
Posted

1 solution

Just that line doesn't help us put it in context to work out what else you may be doing.
So the code above that line - you say that "you can write once in the file" - may be relevant as well.

At a guess, you are trying to reuse the file stream that you used for writing the file, and that is probably the cause of the problem. If the stream is open from writing, you probably can't reuse it for reading via a separate StreamReader!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900