Mail Archives: djgpp/1996/11/24/04:40:37
On Sat, 23 Nov 1996, Faulkner wrote:
> Here's a problem for the DJGPP people of the world.
> I've got 2 structures, a VertexType and a PolygonType, both are simple
> and short structures. I write 20 vertices to a file, then 20 polygons
> to a file. When I read the file back into memory any element that
> has the no. 13 in it goes screwy!!!! (dont worry, I've checked for
> viruses).
You write the file in binary mode (which is correct), but read it in text
mode (which is incorrect). Change this line:
fp=fopen(argv[1], "r");
to say this:
fp=fopen(argv[1], "rb");
then try again.
- Raw text -