Reputation:
I have some file input code:
std::ifstream temp("temp.tmp", std::ifstream::in);
char line = temp.get();
This is alright for now, and it works, so I am using it. My problem is that I need to check each line to see if it equals "this"
. std::getline();
hasn't been working to well for me. All I need is some way to split the char line
into lines, (in a for
loop, maybe??).
Upvotes: 0
Views: 400
Reputation: 76245
std::getline
is the way to go. If you can't get it to work, post the code in a new question.
Upvotes: 0
Reputation: 422
the type of line
is not char array, as implied in your question, but rather a single char
variable. I strongly urge you to look into std::string
s instead of char array (c-style strings). Documentation of strings
Upvotes: 1