B
Borde
Guest
Hello everyone.
I'm writting a little program and I found a big problem. When I try to execute this:
fread(Polygons,sizeof(s3DModelPolygon), NumPolys,is);
I get an error (fread returns 0 and errno is set to 22). Polygons is a dinamically allocated array created with malloc (it didn't returned NULL, so it should be correct, right?)
NumPolygons=516
sizeof(s3DModelPolygon)=24
That makes a total of 12384 bytes.
Well, hope someone arround here has an answer. I've been googling for hours and I'm tired.
Must I surrender and read each polygon one by one?
EDIT: Never mind, I'll just stop using that crappy malloc. It works perfectly using new[].
I'm writting a little program and I found a big problem. When I try to execute this:
fread(Polygons,sizeof(s3DModelPolygon), NumPolys,is);
I get an error (fread returns 0 and errno is set to 22). Polygons is a dinamically allocated array created with malloc (it didn't returned NULL, so it should be correct, right?)
NumPolygons=516
sizeof(s3DModelPolygon)=24
That makes a total of 12384 bytes.
Well, hope someone arround here has an answer. I've been googling for hours and I'm tired.
Must I surrender and read each polygon one by one?
EDIT: Never mind, I'll just stop using that crappy malloc. It works perfectly using new[].
Last edited: