So I have been doing well in my C++ class all year, but nearing finals I sort of got behind on this chapter reading and writing files and all that good stuff. Anyhow, I get errors and nothing works and I don't know why. The code needs to access a txt file (which I have) that contains values. It needs to skip the header (which I think it should), and read the values and assign them to the struct. The functions need to access the structs and then the structs updated again, reading from the file again.
This is a SIMPLIFIED version of the code, I removed a bunch of the functions as they aren't really the problem except I am wondering how to get them to access the structs because I haven't gotten it working enough to test that;
using namespace std;
double Old, New;
OldNew gpsTime, gpsX, gpsY, gpsZ, dist, speed;
void SkipHeaderInfo(ifstream &inFile)
for(int i = 0; 0 < 14; i++)
void ReadData(ifstream &Data)
cout << "Error occured\n";
inFile >> Data.gpsTime.New >> Data.gpsX.New >> Data.gpsY.New >> Data.gpsZ.New >> inFile.ignore(1024, '\n');
void Time(ifstream &Data, double time)
time = Data.time.New - Data.time.Old;
So again, what I need help with;
1) Getting ReadData to read data from the file
- The error I get says something along the line of "has no member named"
and then it says gpsTime, gpsX, gpsY, gpsZ.
2) Making sure the functions will call the structs, no errors so far, but that is because I haven't been able to test it so far.
I guess those are my 2 main problems. Any help appreciated! Thanks!
*I am using Putty and g++ compiler if it makes any difference.