forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

getfilesize function

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Klimru



Joined: 09 Apr 2005
Posts: 34

PostPosted: Tue Jun 21, 2005 2:07 am    Post subject: getfilesize function Reply with quote

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
View user's profile Send private message
Vampire



Joined: 12 Apr 2005
Posts: 138

PostPosted: Tue Jun 21, 2005 7:24 am    Post subject: Reply with quote

another possibility is to seek the end of the file:
Code:
filesize = sceIoLseek(fd, 0, SEEK_END);
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Tue Jun 21, 2005 10:38 am    Post subject: Reply with quote

But seeking requires you to open and close the file, even if you aren't planning on reading from it :).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group