Posted on 2004-08-07
I'm trying to do the equivalent of the easy C code here
int someNum = atoi( someArray );
Where someArray is an array of characters.
You would think that this would work:
someArray = '9';
int someNum = Convert.ToInt32(someArray);
//but someNum = 57 since ASCII 9 = 57.
So I am using this:
int arm2 = Convert.ToInt32(new string(rec,84,1));
Is there an easier (faster) way of doing this? I am doing some reading/writing ascii files that reads in a line and pulls numbers from it using these converts. I am trying to cut down on the time it takes for it to read all the stuff from the file.