i have problems using the getopt().
when i use printf() to print the optarg of case S, it tells me that it is (null).Code:... char lala, test[2]; while((lala = getopt(argc, argv, "m:S:")) != EOF) { switch(lala) { case 'm': { printf("%s\n", optarg); .... break; } case 'S': { printf("%s\n", optarg); sscanf(optarg, "%x:%x", test[0], test[1]); break; } default: break; } }
so i get a segmentation violation.
why is optarg (null)?
thanks