 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Conflict

Joined: 11 May 2005 Posts: 8 Location: UK, York
|
Posted: Sat Feb 04, 2006 9:28 am Post subject: fscanf trouble |
|
|
hello, I am somewhat new here but have been following PSP development here for many many months.
I have commenced a project and at the moment i am experimenting with implementing a ASE loader for the PSP.
I am currently having trouble however using fscanf to readin a single string is causing my psp to hang and shutdown.
| Code: |
int main(int argc, char* argv[])
{
FILE *fd_in;
int fd;
//int bytes_in = 0;
char msg[20] = "OK";
char data_in[128] = "";
if(!(fd = sceIoOpen("ms0:/PSP/GAME/3dshooter/cube.ase", PSP_O_RDONLY, 0777)))
{
strcpy(msg, "file IO error");
}
fd_in = (FILE *)fd;
fscanf(fd_in, "%s", data_in);
...
...
...
|
With the fscanf line commented the app loads fine and enters the main render loop.
I have tried many things to resolve this to no avail.
Thanks in advance for help
::lee _________________ <,<; |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Sat Feb 04, 2006 2:31 pm Post subject: |
|
|
You can't cast the result of sceIoOpen to a FILE *. You should use fopen() to get a FILE * instead, if you're intending to use fscanf.
Jim _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
Conflict

Joined: 11 May 2005 Posts: 8 Location: UK, York
|
Posted: Sun Feb 05, 2006 6:20 am Post subject: |
|
|
ahh rightio, yea i got the (FILE *) casting from inspecting the PSPquake src, they defined their own fopen to return (FILE *)fd, must have missed something.
i wasn't sure if fopen was possible with PSPdev, should have tried it really what i newbie i must look. ;D
Anyway kudos Jim :>
...Been working all day with fscanf on loading a ASE file, got it working very well, only loads ASEs which are one object at the momment, loads all vertex, face and UV info and renders to screen fine. I "pushed" it with a 3000k tris ASE and still going at 60fps :>
Thanks again! _________________ <,<; |
|
| Back to top |
|
 |
|
|
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
|