[fpc-pascal] Typed file problem.
Inpromptu
inpromptu at operamail.com
Thu Jun 23 01:12:19 CEST 2005
Problem solved !
Thank you very much !
>
> Inpromptu wrote:
> > I've found the problem... !
> >
> > if the record is Myrecord=record
> > MyInteger:integer;
> > Mystring:string;
> > end;
> >
> > compiled with c:\lazarus\pp\bin\i386-bin\ppc386 without any other
> > parameter, sizeof(Myrecord.Myinteger) shows 2.
> >
> > compiled inside Lazarus sizeof(Myrecord.Myinteger) shows 4 !
> >
> > Because of this, Mystring is readed wrong from the file.
> >
> >
> > I think this is a trivial problem, but I don't know how to force
> > MyInteger to be 2 bytes long inside and outside Lazarus... Or 4
> > bytes long ?
> >
> >
>
> Size of Integer depends on FPC $mode used. See
> [http://www.freepascal.org/docs-html/prog/progap4.html]. So you can
> force Integer to be of specific size by making sure that FPC always
> uses the same $mode, whether you compile console version or GUI
> version from Lazarus.
>
> Or you can use "SmallInt" or "LongInt" (depending on what you want
> -- 2 or 4 bytes ?) to be sure that, regardless of $mode used, your
> MyInteger has always the same size. See
> [http://www.freepascal.org/docs-html/ref/refsu5.html].
>
> Michalis
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
--
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 8 at http://www.opera.com
More information about the fpc-pascal
mailing list