How not to interrupt fileIO when shutting down PSP

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

How not to interrupt fileIO when shutting down PSP

Post by Art »

Hi Guys,

A log file is saved to MS anytime a program that I'm writing exits, and
the size of the log file is depends on how long the program has been running,
and what events have been logged, etc.

I leave a lengthy delay to make sure the file writing is complete before using
PSPStandby to shut down the PSP.

Now most of the time it's only saving a small file, and waiting a big delay for nothing.
Is there a way to tell at runtime that the file access is finished so I
can have it exit quicker?
Cheers, Art.
User avatar
groepaz
Posts: 305
Joined: Thu Sep 01, 2005 7:44 am
Contact:

Post by groepaz »

use fflush before fclose ?
sectoid
Posts: 3
Joined: Mon May 28, 2007 9:16 am

Post by sectoid »

yea fflush sounds like what you need to use..

#include <stdio.h>
int fflush(FILE *FP);

`fflush' returns `0' unless it encounters a write error; in that situation, it returns `EOF'.
cloudhunter
Posts: 86
Joined: Thu Aug 17, 2006 3:27 am

Post by cloudhunter »

Used fflush myself, worked fine :)

Cloudy
:)
Post Reply