M
Matt
Hello. This should hopefully be a quick question!
I have a programme given below which deals with any arguments given to
the programme by the user (see a previous post titled "Problem
Outputting Command Line Arguments from argv" to see my previous
problems with this programme).
Basically for some reason the programme is swapping round the values
of argv[1] and argv[2] with argv[3] and argv[4]. I've made the
programme output this to illustrate what I mean:
"> ./main.exe file1 file2 -c '/dir1/dir2/default_config'
----Before getopt_long function----
argc = 5
argv[0] = ./main.exe
argv[1] = file1
argv[2] = file2
argv[3] = -c
argv[4] = /dir1/dir2/default_config
option -c with value `/dir1/dir2/default_config'
non-option ARGV-elements: file1 file2
----After getopt_long function----
Count = 2
argc = 5
argv[0] = ./main.exe
argv[1] = -c
argv[2] = /dir1/dir2/default_config
argv[3] = file1
argv[4] = file2
Stack mode OFF"
I believed the problem was caused by the area from line 124 where I
get the programme to read all "non-relevant" arguments given to the
programme by the user. However my attempt to undo any changes made to
where the pointer is located on line 135 don't seem to have made any
difference.
Any help anyone can offer will be much appreciated.
Kind Regards,
Matt
I have a programme given below which deals with any arguments given to
the programme by the user (see a previous post titled "Problem
Outputting Command Line Arguments from argv" to see my previous
problems with this programme).
Basically for some reason the programme is swapping round the values
of argv[1] and argv[2] with argv[3] and argv[4]. I've made the
programme output this to illustrate what I mean:
"> ./main.exe file1 file2 -c '/dir1/dir2/default_config'
----Before getopt_long function----
argc = 5
argv[0] = ./main.exe
argv[1] = file1
argv[2] = file2
argv[3] = -c
argv[4] = /dir1/dir2/default_config
option -c with value `/dir1/dir2/default_config'
non-option ARGV-elements: file1 file2
----After getopt_long function----
Count = 2
argc = 5
argv[0] = ./main.exe
argv[1] = -c
argv[2] = /dir1/dir2/default_config
argv[3] = file1
argv[4] = file2
Stack mode OFF"
I believed the problem was caused by the area from line 124 where I
get the programme to read all "non-relevant" arguments given to the
programme by the user. However my attempt to undo any changes made to
where the pointer is located on line 135 don't seem to have made any
difference.
Any help anyone can offer will be much appreciated.
Kind Regards,
Matt