Add new utility function PHYSFS_printf() to easily write text files with PhysicsFS.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7704 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
b598cfbc6a
commit
d93e1751c0
|
@ -36,6 +36,7 @@
|
|||
#include "frameresource.h"
|
||||
#include "input.h"
|
||||
#include "SDL_framerate.h"
|
||||
#include "physfs_ext.h"
|
||||
|
||||
#include "cursors.h"
|
||||
|
||||
|
@ -597,3 +598,15 @@ int gettimeofday(struct timeval* tv, struct timezone* tz)
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool PHYSFS_printf(PHYSFS_file *file, const char *format, ...)
|
||||
{
|
||||
char vaBuffer[PATH_MAX];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
vssprintf(vaBuffer, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
return PHYSFS_write(file, vaBuffer, strlen(vaBuffer), 1);
|
||||
}
|
||||
|
|
|
@ -85,4 +85,6 @@ static inline bool PHYSFS_readBEFloat(PHYSFS_file* file, float* val)
|
|||
return (PHYSFS_readUBE32(file, readValue) != 0);
|
||||
}
|
||||
|
||||
bool PHYSFS_printf(PHYSFS_file *file, const char *format, ...) WZ_DECL_FORMAT(printf, 2, 3);
|
||||
|
||||
#endif // _physfs_ext_h
|
||||
|
|
Loading…
Reference in New Issue