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

Reply via email to