Serialisation

Hello all,

I’ve looked through the sources and docs and apart from
a reference to a FILE I/O subsystem, I can find nothing
else that relates to serialisation.

Are there things like SDL_fopen(), SDL_fclose(), etc.?

How do you read things from files and write things to files
using SDL? Do I just use standard c/c++ streams or
is there an SDL way?

cheers,
K.

Kostas Kostiadis writes:

How do you read things from files and write things to files
using SDL? Do I just use standard c/c++ streams or
is there an SDL way?

Why do you want an SDL way? Aren’t the standard libs portable enough?
:wink:

Standard libs are fine, I was just curious what
the FILE I/O subsystem is all about…

Also, if there is an SDL interface to serialisation,
I’d like to have a look at it, before I try to re-invent
the wheel :wink:

Cheers,
K.> ----- Original Message -----

From: George Ogata [mailto:g_ogata@optushome.com.au]
Sent: 19 April 2004 14:06
To: sdl at libsdl.org
Subject: Re: [SDL] serialisation

Kostas Kostiadis <@Kostas_Kostiadis> writes:

How do you read things from files and write things to files
using SDL? Do I just use standard c/c++ streams or
is there an SDL way?

Why do you want an SDL way? Aren’t the standard libs portable enough?
:wink:


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

To my knowledge there is no “SDL way” of doing it.
But there are alot of other readymade libs to do it… I think :wink:

/ Daniel Liljeberg> ----- Original Message -----

From: kos@climaxgroup.com (Kostas Kostiadis)
To:
Sent: Monday, April 19, 2004 3:30 PM
Subject: RE: [SDL] serialisation

Standard libs are fine, I was just curious what
the FILE I/O subsystem is all about…

Also, if there is an SDL interface to serialisation,
I’d like to have a look at it, before I try to re-invent
the wheel :wink:

Cheers,
K.

-----Original Message-----
From: George Ogata [mailto:g_ogata at optushome.com.au]
Sent: 19 April 2004 14:06
To: sdl at libsdl.org
Subject: Re: [SDL] serialisation

Kostas Kostiadis writes:

How do you read things from files and write things to files
using SDL? Do I just use standard c/c++ streams or
is there an SDL way?

Why do you want an SDL way? Aren’t the standard libs portable enough?
:wink:


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Kostas Kostiadis wrote:

Hello all,

I’ve looked through the sources and docs and apart from
a reference to a FILE I/O subsystem, I can find nothing
else that relates to serialisation.

Are there things like SDL_fopen(), SDL_fclose(), etc.?

How do you read things from files and write things to files
using SDL? Do I just use standard c/c++ streams or
is there an SDL way?

cheers,
K.

There is the SDL_RWops structure (see SDL_rwops.h) which provides a consistent interface to a variety of storage locations (e.g. files, memory, etc.),
and the functions in SDL_endian.h help make files which are portable across machines of different endianness.
Apart from these, you can just use the standard functions.

Chris E.
-------------- next part --------------
A non-text attachment was scrubbed…
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040419/6067d43c/attachment.pgp

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On Monday 19 April 2004 15:30, Kostas Kostiadis wrote:

Standard libs are fine, I was just curious what
the FILE I/O subsystem is all about…

If you’re talking about the RWops stuff: Basically, they are a way to use
SDL functions that deal with files with custom file handling code.

For example, the function (actually, it’s a macro) SDL_LoadBMP() takes a
filename as a parameter. Now what if you want to use .zip files to manage
your data, like e.g. Quake 3? SDL_LoadBMP() will obviously not work.

That’s where SDL_LoadBMP_RW() comes in handy. You will have to create an
RWops structure and fill in all the relevant details. In particular, this
means you’ll have to write callback functions for seek, read, etc. that
operate on a file stored inside a .zip file (obviously, you’ll also need
a .zip from somewhere). Then you can pass this structure to
SDL_LoadBMP_RW(), and it Just Works.

cu,
Nicolai
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAg/SVsxPozBga0lwRAknoAKCOeU5vCtWuiiOtoFP/3ZaZlBqOoQCg1gJ2
P8DZ+VmY+b4NmVED645SYr4=
=T3RB
-----END PGP SIGNATURE-----