Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
Hello all, I want to see if there is away to preserve the decimal points with this code chunk: int main() { char string[] = "T1 +24.04,T2 +25.27,TD +1.32"; char seps[] = " ,"; char *token, *T1s, *T2s, *TDs; double T1,T2,TD; token = strtok( string, seps ); T1s = strtok( NULL, seps ); token = strtok( NULL, seps ); T2s = strtok( NULL, seps ); token = strtok( NULL, seps ); TDs = strtok( NULL, seps ); printf("%s\t%s\t%s\n",T1s,T2s,TDs); T1 = atol(T1s); T2 = atol(T2s); TD = atol(TDs); printf("%d\t%d\t%d\n",T1,T2,TD); return 0; } Output: +24.04 +25.27 +1.32 0 1077411840 0 If I use atoi out right I get no decimal, for obvious reasons. Thanks, Anthony
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |