Skip to content

Instantly share code, notes, and snippets.

@dattaz
Created April 3, 2016 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dattaz/21e4849b2c1594747df974dac98184f6 to your computer and use it in GitHub Desktop.
Save dattaz/21e4849b2c1594747df974dac98184f6 to your computer and use it in GitHub Desktop.
what ?
me@host:/tmp$ cat temp.c
#include <stdlib.h>
#include <stdio.h>
int main(){
char temp[512] = "06:04,1";
printf("%c %c %c %c\n",temp[0],temp[1],temp[3],temp[4]);
printf("%d %d %d %d\n\n",atoi(&temp[0]),atoi(&temp[1]),atoi(&temp[3]),atoi(&temp[4]));
return EXIT_SUCCESS;
}
me@host:/tmp$ ./a.out
0 6 0 4
6 6 4 4
@dattaz
Copy link
Author

dattaz commented Apr 3, 2016

logique, atoi prend une chaine et s'arrete au premier caratères non numérique.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment