[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interview

"Philipp Gühring" wrote:

> That sounds logical. So we have to work every struct element by
> element. But I don´t like that because it produces problems, when I
> change the struct, and it´s a lot of code.

What, you have multiple places where you load and write the content of a
given struct to/from a file?

Me, in straight C, when I have a PlayerData struct I need to read/write
to a file, I create two functions, ReadPlayerData(FILE*, struct
PlayerData*) and WritePlayerData(FILE*, struct PlayerData*) which do the
job. Only two places to change if the struct changes: the write function
and the read function.

Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi