0

roReadLine to integer



I need to read variables from an external file. The variables are all integer values. I've figured out how to read strings from txt files using the ReadLine() command, but I get a type mismatch error when I try to used them as integers. Is there a function to switch variable types, or am I stuck?

2 comments

  • 0
    Avatar
    RokuLyndon


    Yes,



    There's a function called, val, that will convert a string into it's integer form.



    So, if you read in "5", val("5") = 5.





    VAL (string)

    Performs the inverse of the STR$ function: returns the number represented by the characters in a string

    argument. The numerical type of the result can be integer, float, or double precision, as determined by the

    rules for the typing of constants. For example, if A$="12" and B$="34" then VAL(A$+ "."+B$) returns the value 12.34.
  • 0
    Avatar
    EdgeVetto


    Excellent, thanks a lot Lyndon.
Please sign in to leave a comment.