arg[2] == arg + 2
consider
arg[ 0 ] = arg + 0
arg[ 1 ] = arg + 1
arg[ 2 ] = arg + 2
how far down is 2? is it 3 spots or simply 2 and if argc == 2, what does this mean?
Printable View
arg[2] == arg + 2
consider
arg[ 0 ] = arg + 0
arg[ 1 ] = arg + 1
arg[ 2 ] = arg + 2
how far down is 2? is it 3 spots or simply 2 and if argc == 2, what does this mean?
I believe it means it is passing two arguments into the program
Now I ask if c arrays are based on a zero base or a 1 base?
I thought 1 base
think again :D It is zero base. arg[ 0 ] is the first argument. arg[ 0 ] is filled in by NOT YOU, but the os. this is how it works. arg[ 1 ] is your second argument passed to your exe AND is the first one you sent.
so
int arr[ 1 ];
arr[ 0 ] = 0; good
arr[ 1 ] = 0; Bad!
k ill stop posting
Your problem when you entered the full path on the command-line is that your file name contained spaces.
When entering a command-line parameter, and that parameter has spaces, you use double quotes around that parameter.
Regards,Quote:
palindrome.exe "C:\A File Name With Spaces\input.txt"
Paul McKenzie
Do what you like, but I suggest you try the code from #28( unmodified ) and pass both the input file and the output file. If there is any error with the code, we can help, but if you can't run your exe with the appropriate command lines or with the debugger, we really can't help you :(.Quote:
Originally Posted by jimJohnson123
Follow this http://stackoverflow.com/questions/2...-visual-studio