Jump to content

string to integer problem

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Masonic

Masonic

    Newbie

  • Members
  • PipPip
  • 10 posts
hi, im writing simple program.
i have entered text as string and i want to change first 6 characters of that string to integer, i wanted to use val function, but it's always returning exitcode 217. i think that val don' t like syntax of s[1..6];, but i don't know how do it in other way.
so if someone can help me? i just need this - s[1..6] turned to integer. i don't want to use stringtoint function

im using free pascal
if u need full code, just ask...

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Why not use the copy function to get the first 6 characters, and then strtoint to convert it?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Masonic

Masonic

    Newbie

  • Members
  • PipPip
  • 10 posts
thanks man