Error meaning

I am new to c++ and programming in general, and I am in an introductory c++ course. We have to create a program that allows a user to create a random array of a certain size, save it to a file, read from it, and find certain things about it. My problem is I am having difficulty with the file part. I keep getting an error leading me to a header file titled ios_base.h and this line: ios_base(const ios_base&); and here is the error... In copy constructor `std::basic_ios<char, std::char_traits<char> >::basic_ios(const std::basic_ios<char, std::char_traits<char> >&)':
Any help with file writing and reading in functions and help with this error is greatly appreciated.
Post the code that you're having trouble with, it sounds like you're using a standard library function incorrectly.
case 2: cout<< "Reading data from file\n";
ifstream inFile;
int datarray[100];
arraylength = readFile (inFile, datarray);
break;
error is where I call my readFile function.
Try changing the function signature for readFile to:

int readFile(ifstream&, int[]);

The & is there so that the ifstream is passed by reference. You're probably passing the ifstream by value and that's causing the error.
Yep! That solved it. Thank you very much. The power of refernce variables.
Topic archived. No new replies allowed.