I know that this was probably asked earlier, but I can’t find it here anywhere, and I can’t get a clear answer to everything I’m looking for on Google.
I need to know the C # equivalent for C ++ ifstream / ofstream.
For example, if I had the following C ++ code:
ifstream input("myFile.txt");
ofstream output;
output.open("out.txt");
What is the C # equivalent?
I found a site that said (for part of the file anyway) that the equivalent was as follows:
using System.IO;
FileStream fs = new FileStream("data.txt", FileMode.Open, FileAccess.Read);
I tried to include this:
FileStream fs = new FileStream(input, FileAccess.Read);
I do not have “FileMode” in mine, because VS did not recognize it. And "input" is a string in the parameters that contains the string value of the input file name (for example, "myFile.txt").
I know that I need to miss something stupid and insignificant, but I can not understand what it is. Any help on this would be greatly appreciated!
VS2010, # -4.0, API WPF.