Thank you all pointing me out to Variant.

Thank you and have a nice day.



______________________________________________________________
> Od: "Mario Ray Mahardhika" <leledumbo_c...@yahoo.co.id>
> Komu: "Other FPC related discussions." <fpc-other@lists.freepascal.org>
> Datum: 10.02.2012 03:20
> Předmět: Re: [fpc-other] Get/Detect Variable Type
>
>Suggestion:
>Overload the procedure for each type you'd like to support instead.
>
>
>________________________________
> From: Sven Barth <pascaldra...@googlemail.com>
>To: fpc-other@lists.freepascal.org 
>Sent: Thursday, February 9, 2012 10:57 PM
>Subject: Re: [fpc-other] Get/Detect Variable Type
> 
>Am 09.02.2012 14:49, schrieb tazmande...@centrum.cz:
>>
>> Hi all,
>>    how can i simple get type of variable in freepascal?
>>
>> For example:
>>
>> procedure RawWrite(v:anyvariable)
>> begin
>> if GETTYPE(v)=string_type then begin;stringwork(v);end;
>> if GETTYPE(v)=byte_type then begin;dobyte(v);end;
>> if GETTYPE(v)=pchar_type then...
>> if GETTYPE(v)=pointer_type then...
>> etc...
>> etc...
>> end;
>>
>> or use a CASE statement
>>
>>
>> Is there any way to detect variable type?
>
>The best you can do is using Variant as variable type. See here: 
>http://www.freepascal.org/docs-html/ref/refse18.html#refsu20.html
>Also take a look at unit Variants (for which no documentation exists yet 
>though).
>
>Regards,
>Sven
>
>_______________________________________________
>fpc-other maillist  -  fpc-other@lists.freepascal.org
>http://lists.freepascal.org/mailman/listinfo/fpc-other
>
>----------
>
>_______________________________________________
>fpc-other maillist  -  fpc-other@lists.freepascal.org
>http://lists.freepascal.org/mailman/listinfo/fpc-other
>
_______________________________________________
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-other

Reply via email to