Porting to Delphi 2009 - Invalid Typecast Error

I am converting a GraphicEx project to Delphi 2009.

I am having trouble converting the following procedure to unit Scanf_c.pas . Here's the problem:

  With TscRec(FType) do begin

      

FType is an integer and is defined by TscRec:

  TscRec = packed record  // Has size of an integer
      Case byte of
        0: ( Typ : byte; Size : char; Flags : word;);
        1: ( SizeType : word; iFlags : smallInt;);
      end;

      

This code seems to work fine in delphi 2007, but I have a problem compiling it in Delphi 2009. Compiler error - "Invalid Typecase". The problem is when simulating FType is an integer in TScRec which is a record.

Does anyone have such problems with Delphi 2009 and is there a solution.

thank

+2


source to share


1 answer


"char" is now a 2-byte data type. What happens if you change the declaration to "ansichar"? (This is the equivalent of "char" in Delphi <= 2007).



+12


source







All Articles