PDA

View Full Version : reading in from an infile



incus
05-18-2002, 06:52 AM
i am proting code from unix to windows and am using glut.lib. i am using visual c++ 6.0 to compile. here is some code that i am using to read the data in it works in unix but not visual c++ :
void getData(char * fileName) {
cout<<"HERE"<<endl;
ifstream inStream;
//inStream.open(fileName,ios::in);
//inStream.open("knot3.txt",ios::in);
inStream.open("seven.txt");
int numvertices=0;
cout<<numvertices<<endl;

if(inStream.fail())
{
cout<<"fail"<<endl;
return;
}

//int numvertices;
// GLfloat x,y,z;

inStream>>numvertices;
cout<<numvertices;

// glBegin(GL_LINE_LOOP);
for (int i = 0; i<numvertices;i++) {
cout<<"here";
lines c;
inStream >> c.X >> c.Y >> c.Z;
cout<<c.X<<" "<<c.Y<<" "<<c.Z<<endl;
//dotVector.push_back(c);
dotVector[i] = c;
}
// glEnd();
glFlush();
inStream.close();
}

any ideas?

davepermen
05-18-2002, 08:45 AM
and where is the opengl question?
btw, where is the problem? what is the error? i just read its not working.. that means? not compiling? not running? wrong results? whats going on?
oh, and where is he opengl question? http://www.opengl.org/discussion_boards/ubb/wink.gif