Jump to content

Photo

Casting from char to int


  • Please log in to reply
2 replies to this topic

#1 cavthena

cavthena

    Apprentice

  • Members
  • Real Name:Clayton
  • Location:I wish I knew

Posted 25 October 2016 - 04:13 PM

For my map script I'm using the dmap name to store critical information required for drawing the map. When collecting this information the script stores it in an int array[] as characters (with the ''). Is it possible to drop the quotations and access the raw data? As an example I might grab '10' from the dmap name. Can I drop the '' and be left with the number 10 in its place?

#2 Saffith

Saffith

    IPv7 user

  • Members

Posted 25 October 2016 - 05:18 PM

There's no distinction between text characters and numbers; 'A'==65 is true. But text numerals aren't the same as the numbers they represent, so if you want to read "10" as 10, you'll need something like the atoi() function in string.zh.

#3 cavthena

cavthena

    Apprentice

  • Members
  • Real Name:Clayton
  • Location:I wish I knew

Posted 25 October 2016 - 10:14 PM

simple enough. That'll do nicely, thanks Saffith!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users