Reading data with streams issue (C Sharp)

Back to General discussions forum

grimitsu     2016-05-12 15:21:44

Got a problem with reading input data from streams. When I'm creating FileStream with FileMode.Open or OpenOrCreate with path, for example "data.txt" it just gives exception on compilation, while this code perfectly works in VS (had to test it elsewhere). Same goes for StreamReader. For example:

StreamReader sr = new StreamReader("data.txt"); or StreamReader sr = new StreamReader(new FileStream("data.txt", FileMode.Open));

Is it possible to work with streams? What am I doing wrong then? Should I just continue reading input with console functions?

Would be gratefull for any reply.

Photon     2016-05-13 17:07:49
User avatar

If you want to work with streams, you can just use VS to write programs, and then just paste code and answer to problem. And if you want your code to run in browser (executed in remote server) when you should continue using console functions

grimitsu     2016-05-13 20:54:49

Ok, gotcha. Thanks for the answer.

Please login and solve 5 problems to be able to post at forum