anAppBuilder
asked on
How do I get a string from a file using ifstream
I want to read a char array from a file using ifstream. However I am getting extra garbage at the end of the read in string. How do I eliminate that? Please see attached files.
Thank you!
myTest.cpp
testFile.txt
stringAsReadIn.txt
Thank you!
myTest.cpp
testFile.txt
stringAsReadIn.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you, Sara. Very clear explanation. I've gotten many accurate and helpful answers from Expert's Exchange. This is one of the best: clear, accurate and very well-written.
cout << "==>" << cString << "<==" << endl;