Re: It is possible to copy to a variable the selected index of a string?
If you just want to extract the index (part after the decimal pointer) you can use this method also (in case your index part is in integer bounds)
If you have scanned it as a floating point number:
1>Convert it into a STRING.
2>Then use standard function strtok() with the delimiter as "." and get the second token.
3>This is your index but in string format.
4>Convert it into an integer number.
If you have taken the input as string itself and want the index to be in string format only then disregard step 1 and 4.
Re: It is possible to copy to a variable the selected index of a string?
That's not Aia's code, and it seems to be incorrect. Here's a working example. It lacks proper error checking for strtol, though. See the link in Aia's post above for the scoop on strtol.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.