About passing a fstream type parameter into a function

Guys, I know some basic knowledge about passing parameter into subfunctions, but as I really don't know how fstream type actually work, I can't be 100% sure about what will go on after the code like this runs:
1
2
3
fstream ldFile;
ldFile.open("sequence",ios::in);
loadFile(ldFile) // loadFile is a function declared else where, designed to read the content of the file. 


Alright, the code is something like this. Firstly, I wonder what exactly is transferred into that subfunction when I called loadFile. And after that, I wonder if ldFile is totally unchanged after My calling the function.

Thanks for the help~
Last edited on
fstream can't be copied so it must be passed by reference to the function. Any changes to the fstream inside the function will affect ldFile because they share the same object.
And so, if I call the loadFile(ldFile) function again, it will start at the pointer the last time the function left behind? And I don't have to return the ldFile back into the main function to do so?
Correct.
Topic archived. No new replies allowed.