Please help ! read .ase file

I need help to read .ase files!
this is the way I do to read a line and save it for later use:

void LoadAse(char *filename)
{
char buff[200];
ifstream fin:

fin.open(filename);

do {
fin.getline(buff, sizeof(buff));

if(strcmp("*MESH_VERTEX", buff) == 0)
sscanf(buff, “*MESH_VERTEX %f %f %f”, &object.x, &object.y, &object.z);

}while(fin.eof() =! 1)

this line : sscanf(buff, “*MESH_VERTEX %f %f %f”, &object.x, &object.y, &object.z); doesn´t work because the *MESH_VERTEX isn´t at the start of the line how to fix this ?

Hardly related to opengl…

Anyway, try put %s in the format string and a dummy variable to catch the MESH_VERTEX.

[This message has been edited by AndersO (edited 02-28-2001).]

thanks for that I got a step on the way but I can´t read the Faces now I don´t know whats wrong. I have found a source for reading the ase files. they use fscanf instead of sscanf as I do I have tried to make it almost the same as they have except that I use sscanf and read from a buffer instead of fscanf.

[This message has been edited by McZ (edited 03-01-2001).]

yes, use fscanf(“%s”, &data) where data is an array of 255 characters. then simply do a if(!strcmp(data, “data you are looking for”)) to see if you’re about to read vertices, normals or faces.

btw, it bothers me when someone feels high and mighty enough to complain about non-opengl subjects in this forum, there’s nothing wrong with asking a question that we all know can be answered by the people who read these forums.

gl with the ASE loading! if you have any more questions, email me at s_fonden@mail.plymouth.edu.

Originally posted by s_fonden:
yes, use fscanf(“%s”, &data) where data is an array of 255 characters. then simply do a if(!strcmp(data, “data you are looking for”)) to see if you’re about to read vertices, normals or faces.

Actually it should be fscanf(“%s”, data) if data is a char[255]. Passing it as &data would pass a pointer to the array pointer and the most likely result will be CRASH!!

thanks for your help but I think I have to learn little more about file reading and stuff my C++ book has only a little chapter but I got my .ASE reader to work but now I can´t rotate the object and I´m using the same rotating stuff as I did before and it worked OK then