Hi there,
i got a wicked error which makes me totally mad
i have a file (5,59kb) which i want to access to read out triangle coordinations.
after the 95. cycle (the proceeded data should be ~570 byte) i get an EOF message. also the return value of the fread function call is zero then. but that cant be?! maybe a EOF ascii key is inserted somewhere in the file?
hope any1 got any ideas
the source:
Code:
bool MapEntity::LoadMap( HashString hMap )
{
hMap = "maps/" + hMap + ".mpd";
FILE *File = fopen( hMap.c_str(), "r" );
if( !File )
{
neolog << LogLevel( ERROR ) << "*** cant access map" << endl;
return false;
}
fread( &m_sHeader, sizeof( sHeader), 1, File );
int asd = 0;
for( int i = 0; i < ( (int)m_sHeader.DataSize/( 3*sizeof(unsigned short) ) ); i++ )
{
Vector3d *pTriangle = new Vector3d;
unsigned short x, y, z;
if( feof( File ) != 0 )
asd = 1;
asd = fread( &x, sizeof(unsigned short), 1, File );
asd = fread( &y, sizeof(unsigned short), 1, File );
asd = fread( &z, sizeof(unsigned short), 1, File );
pTriangle->Set( x, y, z );
m_vCoordinates.push_back( *pTriangle );
}
fclose( File );
File = NULL;
Update();
return true;
}