about the comand line arguments of main function

I want to run my program using the command line arguments of main function like this:

1
2
./p2ptv PeerBandwidths={{0.271,0.2,INF},{0.661,0.35,INF},{0.0691,3.5,INF}}


when I input the above command line statement on the linux terminal
there will be errors.


after debuging, my discovery is
1
2
3
4
5
6
7
8
9
(gdb) print argv[1]
$2 = 0xbf87a62c "PeerBandwidths=0.271"
(gdb) print argv[2]
$3 = 0xbf87a641 "PeerBandwidths=0.2"
(gdb) print argv[3]
$4 = 0xbf87a654 "PeerBandwidths=INF"
(gdb) print argv[4]
$5 = 0xbf87a667 "PeerBandwidths=0.661"


this is strange, since what I expect is

 
argv[1]=PeerBandwidths={{0.271,0.2,INF},{0.661,0.35,INF},{0.0691,3.5,INF}}


however, when I ran the program on the IDE "eclipse"
and added the arguments in it, the program ran successfully.
but if I debug the program using "eclipse", the same error is raised too.

what is the reason for this?
thanks!
Last edited on
Please try to run your program by following way
./p2ptv "PeerBandwidths={{0.271,0.2,INF},{0.661,0.35,INF},{0.0691,3.5,INF}}"
I tried
1
2
 ./p2ptv “PeerBandwidths={{0.271,0.2,INF},{0.661,0.35,INF},{0.0691,3.5,INF}}”


still, the {{0.271,0.2,INF},{0.661,0.35,INF},{0.0691,3.5,INF}}
was decomposed and so error was raised

 
Error in parsing input line “PeerBandwidths=0.271” 
You used incorrect quotes.
My example should work properly, I've tried it on my linux machine
yes,you reminded me that the quotes I used are in another format.
I'm sorry
Topic archived. No new replies allowed.