Hi, in first time, sorry for my bad level of english, I'm spanish.

I've a file, that contains lines as:

Code:
-s 5 -d 2 -c 5000 -m 60 -o file1
-s 3 -d 234 -c 50 -m 6000 -o file234567890
-s 5 -d 2 -c 5000 -m 60 -o file3
I read one line, & put the arguments to a matrix, for example:

matrix[0]="-s"
matrix[1]="5"
.....

Then, i pass the matrix to the getopt_long() function, in the first line, the program runs correctly, but, when I read the second line & try to pass to getopt_long the matrix with the second line content, this function returns "-1". This means there
aren't any arguments to process...

I think this problem is because getopt_long() is declared as:

int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind);

The second argument is CONST, this means only one time can I pass the matrix to getopt_long()???


How can I solve it??

Cheers.