Val function
Moderator: Board moderators
Val function
in http://www.freepascal.org/docs-html/ref ... 27400013.3 they say that val can convert hexadecimal numbers into integers, although my program doesn't work with that. Can anyone plz help me?
Try this:The string S can contain a number in decimal, hexadecimal, binary or octal format, as described in the language reference
[pascal]var i,code:integer;
begin
val('$22',i,code);
if code<>0 then
writeln('Error at position ',code,' in $22')
else
writeln('Value: ',i);
end.[/pascal]
See http://www.freepascal.org/docs-html/ref ... 7-160001.5 for more information about this.
Last edited by fpnc on Sun Apr 27, 2003 9:17 am, edited 1 time in total.
Best regards,
Fernando N
Fernando N
Thnx
Well, it works, thanks a lot