Hi all,
I have what is hopefully a simple question:
I'm reading input from a file with the usual statement:
ifstream infile("input.txt");
The file contains simple statements of 2 or 3 words, separated by spaces, one statement per line.
How can I get the input from the file in string format? I have tried every C++ trick I can think of (and even a few that I don't really understand!) but still can't get it to work. I need strings so that I can compare substrings to pre-defined variables
- infile.getline(...) doesn't work, it needs an array of char's as it's first parameter, not a string
- infile >> string_name doesn't work because the string is cut off at the first space
Is it possible?
Thanks,
batgirl