Hi, I am new to c++ programming and trying to make a few test programs to increase my knowledge, I spend four hours researching this one function last night and can not seem to get it working, so obviously I am missing something, I was hoping someone here could correct me on my syntax.
Now, the file input method works fine, it will read line by line (this file only has one line anyway). However I can not get the strings to register a match, and yes I have verified Case.
Thank you in advance for help for this beginner!
EDIT* SOLVED
Finally after 10 hours of sleep, I figured it out. The problem wasn't with strcmp, it was with the program writing the text file. It was writing more than one character for /endline, I fixed it. And it works great now.
PS: I might be wrong, but I think the getline function does not add the newline characters at the end of the string. Instead, it appends a null character. Try without any \n. Or maybe not...
\n Does not seem to work either.
I have to ask this because I am so new to the syntax.
Is my declaration of 'char buffer[256]' causing additional NULL characters at the end or is that only specifying the MAX number of characters allowed in the stream?
Also, comparing it to a literal string do I have to account for the NULL somewhere?
"My Test Phrase" + NULL