Passing a file object as reference parameter to a function?

I'm not quite sure how to do this. I've passed variables to a function before, but never a file object. How would you do this, and how would you prototype such a function?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

// Function Prototypes

string function(&whatgoeshere?);

int main(){

ifstream inputFile("file.dat");
function(&what goes here?);
}

.
.
.

string function(&what goes here?){

return;
}


If any further information is needed, I can provide it.

Thank you,
Free Radical
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <fstream>

using namespace std;

void function(ifstream& file)
{
}

int main()
{
    ifstream file;

    function(file);

    return 0;
}
Didn't expect a response that fast. I had already figured it out a while later. The book I'm using never touches on this, so I had to experiment around to get it. Big thank you regardless though.
Topic archived. No new replies allowed.