On Thu, Apr 17, 2008 at 12:00 PM,  <[EMAIL PROTECTED]> wrote:
>
>  -------- Original-Nachricht --------
>  > Datum: Thu, 17 Apr 2008 11:42:08 +0100
>  > Von: "Paul Herring" <[EMAIL PROTECTED]>
>
> >
>  > Solution 1) Use human readable plain-text.
>  >
>
>  interesting... that would mean, casting everything to char* on export, and 
> back to float / long etc on import. So i wouldn't have to worry about it at 
> all... did i get that right , or do i forget something now?
>  so, i would have to change all types in my save-struct to char[x] depending 
> on type... char[4] for float and long , char[8] for double etc, am i right?
>
>  i guess that would be a good type / bytesize /casting excercise too.

No. You simply have to 'print' your struct to file, as if you were
displaying it on screen:

export_mystruct(struct mystruct* s, file* fp){
      fprintf(fp, "%s\n", s->mystring);
      fprintf(fp, "%g\n", s->myfloat);
      fprintf(fp, "%d\n", s->myint);
};


-- 
PJH

http://shabbleland.myminicity.com/tra

Reply via email to