You could just pass a reference to the ifstream object mto that function, e.g. like
void initialize(std::ifstream& rinf,int *idate, int *itime, int *volume, double *price, char c_price[10], char c_date[10], char c_secs[10], char c_volume[10], int icount) {
rinf.getline(c_secs, 10, ' ');
rinf.getline(c_price, 10, ' ');
rinf.getline(c_volume, 10);
//...
}
and call it like
#include <fstream>
#include <iostream>
...
std::ifstream inf("c:/data/spyprice/clea
initialize(nf,&iate, &itime,&volume, &price, c_price, c_date, c_secs, c_volume, icount);
Main Topics
Browse All Topics





by: bcladdPosted on 2005-01-21 at 18:54:32ID: 13108707
Pass a reference to the stream:
;
void initialize(std::ifstream & localStream, int *idate, int *itime, int *volume, double *price, char c_price[10], char c_date[10], char c_secs[10], char c_volume[10], int icount);
Then you can use
localStream.getlin(*idate)
or whatever.
You might think about references for the output parameters as well. If they are all grouped together, you might want to think about putting them all in a class/struct.
Hope this helps, -bcl