>Surely I don't have to close and reopen the file each time I want to log to it.
What's wrong with that?
You could use psplink and print to stderr to see your debug info
>Or is there a way of trapping the crash so that I can close the file appropriately?
Install an exception handler Link
psPea wrote:>Surely I don't have to close and reopen the file each time I want to log to it.
What's wrong with that?
Isn't that innefficient?
i read it's not possible to do a fflush on psp. You can do a devctl to memorystick to fulsh ALL the files. opening, writing and closing is more efficient ;)
psPea wrote:>Surely I don't have to close and reopen the file each time I want to log to it.
What's wrong with that?
Isn't that innefficient?
i read it's not possible to do a fflush on psp. You can do a devctl to memorystick to fulsh ALL the files. opening, writing and closing is more efficient ;)
ab - thanks for the tip, looks like I'll get my head around installing the exception handler.
pea - when I try the open, write, close regime I find two problems
On the development machine I keep getting a crash on the fprintf after 10 secs or so.
Execution on the PSP is horribly slow and eventually I get the crash.
As pointed out if you get psplink running it comes with its own exception handler so you dont need to set up anything else and will help in development and debugging to boot.
int fflush(FILE *stream)
{
int ret = EOF; // Same as default case below.
switch(LOCAL_FILE(stream)->type) {
case STD_IOBUF_TYPE_GE:
case STD_IOBUF_TYPE_STDOUTHOST:
/* stdout & stderr are never buffered. */
case STD_IOBUF_TYPE_UMD:
/* cd-rom files are read-only so no write buffer to flush. */
ret = 0;
break;
case STD_IOBUF_TYPE_MS:
if (LOCAL_FILE(stream)->flag & (_IOWRT | _IORW)) {
//if (ret != 0) ret = EOF;
/* Need to implement sync or something */
}
else ret = 0;
break;
case STD_IOBUF_TYPE_HOST:
/* flush host file write buffer. */
if (LOCAL_FILE(stream)->flag & (_IOWRT | _IORW)) ret = 0;
else ret = 0;
break;
default:
/* unknown/invalid I/O buffer type. */
ret = EOF;
}
return (ret);
}
as you can see, flushing isn't implemented for MS ;)
TyRaNiD wrote:As pointed out if you get psplink running it comes with its own exception handler so you dont need to set up anything else and will help in development and debugging to boot.
OK, so I'm now trying to install the most recent toolchain but I can't find libusb-dev for OSX anywhere. Does anyone know where this is?