I'm kind of new to C# (come from a C++ background), and I've got a question regarding file reading. Is there a way to read a large number of ints or doubles from a file directly (as easy as in C++)?
I've looked into StreamReader, StringReader and BinaryReader and while I can get it done, I think I must be missing something since it's not nearly as straightforward as it is in C++. So far I've used StreamReader to read the entire file, then use ' ' as a delimiter and get my ints that way.
Basically I'm looking to do the C# equivalent of this:
std::ifstream ins;
ins.open(file_name.c_str());
if(ins.is_open())
{
while(ins)
{
ins >> tmp;
arr[iter] = tmp; iter++;
}
}
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.