| View previous topic :: View next topic |
| Author |
Message |
Klimru
Joined: 09 Apr 2005 Posts: 34
|
Posted: Tue Jun 21, 2005 2:07 am Post subject: getfilesize function |
|
|
Maybe this will be useful for someone...
| Code: |
unsigned long getfilesize(const char *filepath) {
psp_stats pstat;
sceIoGetstat(filepath,&pstat);
return pstat.filesize;
}
------
typedef struct {
unsigned long unknown[2];
unsigned long filesize;
unsigned long unknown2[24]; // guestimate
} psp_stats;
void sceIoGetstat(const char *file, psp_stats *statx);
------
Example:
fs = getfilesize("flash0:/vsh/resource/12.bmp");
|
The unknowns have a lot of info in them... i just dont feel like sorting it out at the moment. For the code i'm writing now, I really only want the file size.
-Klim |
|
| Back to top |
|
 |
Vampire
Joined: 12 Apr 2005 Posts: 138
|
Posted: Tue Jun 21, 2005 7:24 am Post subject: |
|
|
another possibility is to seek the end of the file:
| Code: | | filesize = sceIoLseek(fd, 0, SEEK_END); |
|
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Tue Jun 21, 2005 10:38 am Post subject: |
|
|
| But seeking requires you to open and close the file, even if you aren't planning on reading from it :). |
|
| Back to top |
|
 |
|