Not a clue what you are talking about.
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
strchr() can find where the period is, the rest is the decimal part.
strtol() can convert the decimal part into a long int.
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
strchr() returns a pointer to the first occurrence of the character you want, not to an int.
A call to strtol() will convert string number value representation to long int.
Learn about strtol() over here.
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
>How could I get the value first of 789 in the variable threedigits?
Given:
char number[] = "123456789";
char *chopchop;
char threedigits[4] = {'\0'};
Do:
/* start at beginning of wanted digists */
chopchop = &number[strlen(number) - 3];
/* copy wanted digits as a string */
strcpy(threedigits, chopchop);
include for strlen() and strcpy()
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218