[fpc-pascal] ord() of a string index returns wrong value.
Pew (piffle.the.cat)
piffle.the.cat at iinet.net.au
Sat Jan 29 17:05:16 CET 2011
Hi All,
I have a problem where ord() of a character (single string index)
returns the wrong value. the character is a 'o' which is a 111 value but
the ord of it returns 121 into an integer. What am I doing wrong?
I can reproduce this error in my main application, but when I try to
reproduce it in a smaller test application the error cannot be
reproduced. I can find the error with breakpoints.
ch : integer;
Txt : string;
// Txt is passed as a parameter
i is a loop index
ch := ord(Txt[i]);
// i=7
// Txt[i]=111 'o'
// ch=121
http://pastebin.com/P7Wpkekx
Best Regards,
Peter / pew
More information about the fpc-pascal
mailing list