Hello, for some reason the code I am trying to write throws an exception about using a priviledged instruction. Problem is it is just comparing two values and throwing this out there at me. Maybe I am completely missing something.
Oh and I know its pretty ugly code, you don't need to tell me ^_^
for(int run = 1; run <= 4; run++)
{
FILE* temp;
char* tempin;
switch(run)
{
case 1:
tempout = "temp1";
tempin = file_name_in;
break;
case 2:
tempout = "temp2";
tempin = "temp1";
break;
case 3:
tempout = "temp3";
tempin = "temp2";
break;
case 4:
tempout = "temp4";
tempin = "temp3";
break;
}
ifstream infile (tempin);
temp = fopen(tempout, "w");
double max_x = -9999999;
double max_y = -9999999;
double min_x = 9999999;
double min_y = 9999999;
int swathnum = 1;
vector<Lidar> Swath;
Lidar * pLidar;
double numberholder;
if(run == 2 || run == 4)
while (!infile.eof())
{
pLidar = new Lidar;
infile >> numberholder;
double lastone = numberholder;
pLidar->SetX(numberholder);
infile >> numberholder;
pLidar->SetY(numberholder);
infile >> numberholder;
pLidar->SetZ(numberholder);
infile >> numberholder;
pLidar->SetGround1(numberholder);
if(run == 4)
{
infile >> numberholder;
pLidar->SetGround2(numberholder);
infile >> numberholder;
pLidar->SetGround3(numberholder);
}
if(min_x > pLidar->GetX())
min_x = pLidar->GetX();
delete pLidar;
if(lastone-min_x >= 5)
break;
}
while (!infile.eof())
{
infile >> numberholder;
if(infile.eof())
break;
pLidar = new Lidar;
pLidar->SetX(numberholder);
infile >> numberholder;
pLidar->SetY(numberholder);
infile >> numberholder;
pLidar->SetZ(numberholder);
if(run >=2)
{
infile >> numberholder;
pLidar->SetGround1(numberholder);
}
if(run >=3)
{
infile >> numberholder;
pLidar->SetGround2(numberholder);
}
if(run >=4)
{
infile >> numberholder;
pLidar->SetGround3(numberholder);
}
if(min_x > pLidar->GetX())
{
min_x = pLidar->GetX();
}
if(min_y > pLidar->GetY())
{
min_y = pLidar->GetY();
}
if(max_x < pLidar->GetX())
{
max_x = pLidar->GetX();
}
if(max_y < pLidar->GetY())
{
max_y = pLidar->GetY();
}
Swath.push_back(*pLidar);
delete pLidar;
double cell_y = min_y + cellsize;
if((Swath.back().GetX() - min_x) >= cellsize)
findpoints(Swath, temp, max_x, max_y, min_x, min_y, cell_y, tolerance, cellsize, separator_sign, date, swathnum, run);
}
infile.close();
fclose(temp);
}
The exception gets thrown at if(min_x > pLidar->GetX())
Any help would be great, and any other questions you have throw them at me, thanks!
Cameron