Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Error WSTRING_TO_INT

Anonymous
2012-06-25
2012-06-26
  • Anonymous - 2012-06-25

    Originally created by: Matthias S.

    Hello,

    I have a problem with the following code:

    NumberInString : WSTRING(20) := "16#a";
    NumberΒ  Β  Β  Β  Β : INT;
    Number := WSTRING_TO_INT(NumberInString);
    

    I expect the value decimal 10 but I get the value 37.
    What am I doing wrong?

    Thanks in advance for your help.

    Best regards,
    Matthias

     
  • shooter - 2012-06-25

    wstring name is fault and the first character is a 1 giving 37
    use only the A int he string

     
  • TimvH

    TimvH - 2012-06-25

    Hi Matthias,

    You should use capital letters. "16#A" will return 10.

     
  • Anonymous - 2012-06-26

    Originally created by: Matthias S.

    Hello TimvH, shooter,

    thank you for your help.

    The solution is OK, but I think "a" and "A" should both work.
    But for now it's OK.

    Thanks,
    Matthias

     

Log in to post a comment.