[physfs] open for append & seek & write?

Indy Sams indy at driftsolutions.com
Tue Apr 1 12:33:38 EDT 2008


Hello Vaclav,

      Yep, the is the intended/correct behavior of PHYSFS_openAppend.

      Also note, you should be using 64-bit type specifiers in your
      printf statements. For Win32 (MSVC) it is %I64d, for GCC use %lld,
      I typically just have a define like I64FMT for this so you don't
      have to duplicate code.

Tuesday, April 1, 2008, 11:49:50 AM, you wrote:

VV> Platform is Linux i386
VV> Look at this part of code:

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

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

VV> PHYSFS_close(file);

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

VV> 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

VV> ---
VV> To unsubscribe, send a blank email to physfs-unsubscribe at icculus.org
VV> Mailing list archives: http://icculus.org/cgi-bin/ezmlm/ezmlm-cgi?4



Best regards,
 Indy Sams
 mailto:indy at driftsolutions.com

 P.S. This is what part of the alphabet would look like if Q & R were eliminated.




More information about the physfs mailing list