Ik wil command line opties aan mijn programma geven.
Dit programma gebruikte ik als voorbeeld:
http://www.webperf.net/ab.c
Waarom krijg ik een segfault bij atoi ?
skip is een int.
Dit programma gebruikte ik als voorbeeld:
http://www.webperf.net/ab.c
Waarom krijg ik een segfault bij atoi ?
skip is een int.
code:
1
2
3
4
5
6
7
8
9
| while ((a=getopt(argc, argv, "sdv:u:f:o")) != EOF) {
switch (a) {
case 's':
printf("optarg:%s\n",optarg);
skip=atoi(optarg); <--------------------- segfault
break;
case 'd':
flags |= FL_DEBUG;
break; |