Ok, it works, but it isn't yet perfect...
The code is the following:
opterr = 0;
while ((c = getopt(argc, argv, "a
:")) != -1) {
switch (c) {
case 'a': printf(optarg);
break;
case 'o': printf(optarg);
break;
default: printf("opzione non valida");
break;
}
}
I try:
./myprogram -a argument1 -o argument2
and it print 'argument1' and 'argument2'
but I'd like can specify also more than one parameter in -a option, for example, I would use also this syntax:
./myprogram -a argument1 argument2 argument3 -o argument4
How can I solve this other problem?
Thank you in advance.