Mail Archives: djgpp/1999/03/25/08:15:43
i'm not sure what my version of libc is, but I downloaded it about 1
year and a half ago, and then it was the latest i could get.
i'm writing a free archiver for game programmers using the zlib
compression library.
part of the code requires me to create temporary files and write some
compressed information into that file. since libc has a tmpfile() function,
is used that. however, when i write compressed information to the file and
then retrieve it, it does not come back the same. not even the following
code works:
file = tmpfile();
fseek(file, 0, SEEK_SET);
fwrite(compressed_buffer, 1, compressed_bytes, file);
fseek(file, 0, SEEK_SET);
fread(compressed_buffer2, 1, compressed_bytes, file);
if (memcmp(compresed_buffer, compressed_buffer2, compressed_bytes)==0)
printf("sucess"); else printf("failure");
fclose(file);
even if i'm flushing the buffer after the seek (which i shouldn't have to do
anyway, since the docs say that seek does a flush)
However, if i change the call to fopen() rather than tmpfile(), the code
works fine.
Any ideas?
-={C}=-
- Raw text -