I've been building a program that converts one model file type to a wavefront obj one, but I've ran into a problem when writing my faces to that file.
if(!strcmp(line , "TEX:TOP"))
{
i++;
TEX_TOP << "f " << i << "/" << i << "/" << i << " ";
i++;
TEX_TOP << TEX_TOP << i << "/" << i << "/" << i << " ";
i++;
TEX_TOP << TEX_TOP << i << "/" << i << "/" << i << " ";
i++;
TEX_TOP << TEX_TOP << i << "/" << i << "/" << i << "\n";
}
This part of the code is supposed to output..
f 1/1/1 2/2/2 3/3/3 4/4/4
but comes out as..
f 1971327331/1971327331/1971327331 0x28f5a81971327332/1971327332/1971327332 0x28f5a81971327333/1971327333/1971327333 0x28f5a81971327334/1971327334/1971327334
I've searched for hours and still cannot find a fix.
EDIT: Thanks to LihO, my problem was I was placing the TEX_TOP fstream object at the beginning of each line assuming I was re-declaring it, and the int had to start at 0 in order to count up.
i = 0;
if(!strcmp(line , "TEX:TOP"))
{
i++;
TEX_TOP << i << "/" << i << "/" << i << " ";
i++;
TEX_TOP << i << "/" << i << "/" << i << " ";
i++;
TEX_TOP << i << "/" << i << "/" << i << " ";
i++;
TEX_TOP << i << "/" << i << "/" << i << "\n";
}