[physfs] open for append & seek & write?

Vaclav Vanc vanc.vaclav at gmail.com
Tue Apr 1 11:49:50 EDT 2008


Platform is Linux i386
Look at this part of code:

char string[]="TEST";
PHYSFS_file *file = PHYSFS_openAppend("file.txt");

printf("%d\n",PHYSFS_tell(file));	//This print 0
PHYSFS_seek(file, 2);
printf("%d\n",PHYSFS_tell(file));	//This print 2
PHYSFS_write(file,  string, 1, 4);
printf("%d\n",PHYSFS_tell(file));	//This print 30 -end of the file

PHYSFS_close(file);

It looks I am able to seek, but only for reading. (not for writing...)

2008/3/31, Ryan C. Gordon <icculus at icculus.org>:
>
>  > PHYSFS_openAppend does not delete file contents, but it ALWAYS write
>  > at the end of the file. Is it a bug or feature?
>
>
> It starts writing at the start of the file (hence: "append"), but you
>  should be able to seek back. If you can't, it's a PhysicsFS bug.
>
>  (What platform was this?)
>
>
>  --ryan.
>
>
>
>  ---
>  To unsubscribe, send a blank email to physfs-unsubscribe at icculus.org
>  Mailing list archives: http://icculus.org/cgi-bin/ezmlm/ezmlm-cgi?4



More information about the physfs mailing list