[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File I/O
Christian Reiniger wrote:
> Hi,
>
> Just a little contribution to the madly loved
> "Important-Subprojects-Nobody-Dared-To-Start-Working-At" (TM) series ;)
>
> This time: The File I/O system
>
>
> Ok, now the game decides it needs the wall texture #01. It executes a
>
> ppFile *texture1 = ppfopen ("data/textures/wall/01.png", "r");
>
> call (syntax identical to fopen ()). Now the PPlay File-I/O system looks at the directory structure.
> It finds a file "data/textures/wall/01.png" - so it opens it. Now trying to get wall texture #02 the game executes
One small but VERY important change. Its not
ppFile *texture1 = ppfopen ("data/textures/wall/01.png", "r");
it is
FILE *texture1 = ppfopen ("data/textures/wall/01.png", "r");
stdio is nice and extensible, we can create our own FILE* objects. That way people
get fprintf and freinds automatically (I'm sure I posted that to here before).
I hope this is not some weird GNU extension or anything. Please tell me it is ANSI C.
The nice thing is that in our start off "rapid prototyping" version of PenguinIO would be
#ifndef _ppIO_h
#define _ppIO_h
#include <stdio.h>
#define ppOpenFile fopen
#endif /*_ppIO_h*/
or something like that....
A whole subsystem written in nine lines of CPP, ain't it cool...
> Well, that´s all for now - except for one topic: writing files
Bugger that.
>
>
> So who´s gonna start working? ;-))
Hey, just cut and paste the above code :)