Mail Archives: djgpp/2001/04/18/05:22:32
Tim Van Holder schrieb:
>
> void
> write_struct(VP* obj, FILE* f)
> {
> char* name = obj->nam;
> char* beschreibung = obj->dsc;
> obj->nam = (char*) strlen(name);
> obj->dsc = (char*) strlen(beschreibung);
> fwrite (obj, sizeof (*obj), 1, f);
> fwrite (name, (int) obj->nam, 1, f);
> fwrite (beschreibung, (int) obj->dsc, 1, f);
> obj->nam = name;l
> obj->dsc = beschreibung;
> }
>
> void
> read_struct(FILE* f, VP* obj)
> {
> int len = 0;
> fread (obj, sizeof (*obj), 1, f);
> len = (int) obj->nam;
> obj->nam = (char*) malloc(len + 1);
> fread (obj->nam, len, 1, f);
> obj->nam[len] = '\0';
> len = (int) obj->dsc;
> obj->dsc = (char*) malloc(len + 1);
> fread (obj->dsc, len, 1, f);
> obj->dsc[len] = '\0';
> }
That's nearly exactly who I do handle that.
Since there is a really heavy usage of those structs troughout the
project,
what I wanted to do is just leave alone the very large DJGPP program
which generates the data (writes the structures) as a normal coff
exe-file.
While the visiualisation program (reads and displays the structures
contents)
should run in a M$ window or console. So my idea was to simply
`port==compile'
it from DJGPP + GRX to MINGW + GRX.
(some people think an application is not serious if it doesn't run in a
window... ;)
If this had been possible, it would also have allowed to process already
existing data files without the need to regenerate them taking hours of
runtime.
BTW I couldn't resist to try the `-fpack-struct' switch Eli mentioned:
now MINGW reports the size of the struct being _97_ vs _88_ without the
switch.
DJGPP says _80_ , so indeed that's no help as predicted.
Many thanks for assistance, seems I'll have to go the hard and stony
way...
--
Gruss Waldemar Schultz.
Technische Universität München, Zentrum Mathematik M1, D 80290 München
Tel: +49 (0)89 2892 8226 FAX: +49 (0)89 2892 8228
- Raw text -