I am writing a function to open a binary file. It has two arguments, the first is a struct which the files info will be read and stored to, the second is a C style string containing the name of the file to open. I was given the following code by my instructor to start off with:
Code:
int read_stuff(Stuff records[], char filename[])
{
ifstream infile;
infile.open("filename", ios::in | ios::binary);
assert(infile);
infile.read(0, sizeof(records));
infile.close();
}
Just to let you know, the function is supposed to return an int; if the file opens, it returns a positive value. If the file does not open correctly, the function returns a negative value. I have not written this part of the code yet, and did not think it relative to my question, but if it is, let me know. Anyway, my question is what do the arguments of infile.read() mean, and how does the read file use them. Thanks for reading. Any help would be appreciative.