and the numbers.dat file contains the following (it's also definitely finding the file when I've used it in a worked example using the ifstream data_file("numbers.dat"); )
1
2
3
4
5
I get the following (from Xcode) error: expected ',' or '...' before string constant.
I've been working my way through all of exercise questions (up to Chapter 16 now) and I've been getting on OK. However I've really become stuck on this chapter and I've been messing around for a couple of hours now (re-reading this chapter for the 3rd time.)
I've also been searching google for similar questions but a lot of the forums contain questions very much above my level.
I can't imagine that I'll ever want to do more than read in/out ascii files with the I/O features.
std::istream& getline(std::istream& input_file, std::string& the_string); is not how you call the function. It's the function declaration showing what arguments you need and what the function returns.
Do you understand how functions are called?
Thank-you for the speedy response. I've got it to work now.
I have an alright idea of how functions work but I'm such a beginner that I'm not at the stage where I can just look at it and it registers in my head.
I knew it would be something stupid. I think that's the hard part about solely learning from a book, when you become stuck and you can do is stare at the page and hope that it makes sense.
I'll definitely be coming back here again - soon no doubt.