help with command line arguments...
-
Im going to make a console project... don't ask... and I need to add command line arguments, im using windows xp, and somehow when I add the command line arguments to the end of the filename e.g. somefile.exe /something it says "/" and a bunch of other characters aren't alowed to be used... has windows xp completely taken off command line arguments??:confused: sry its just that the last time I had command line arguments to one of my programs was when windows '98 came out. Actual Linux Penguins were harmed in the creation of this message.
-
Im going to make a console project... don't ask... and I need to add command line arguments, im using windows xp, and somehow when I add the command line arguments to the end of the filename e.g. somefile.exe /something it says "/" and a bunch of other characters aren't alowed to be used... has windows xp completely taken off command line arguments??:confused: sry its just that the last time I had command line arguments to one of my programs was when windows '98 came out. Actual Linux Penguins were harmed in the creation of this message.
/* C madness */ #include <stdio.h> int main(int argc, char** argv) { for (int i = 0; i < argc; i++) printf("Arg %d = %s\r\n", i, argv[i]); return 0; }
This small C program will dump the args. The process of receiving args for console apps hasn't changed a bit ;)
Ian Mariano - http://www.ian-space.com/
"We are all wave equations in the information matrix of the universe" - me -
Im going to make a console project... don't ask... and I need to add command line arguments, im using windows xp, and somehow when I add the command line arguments to the end of the filename e.g. somefile.exe /something it says "/" and a bunch of other characters aren't alowed to be used... has windows xp completely taken off command line arguments??:confused: sry its just that the last time I had command line arguments to one of my programs was when windows '98 came out. Actual Linux Penguins were harmed in the creation of this message.
Oh yeah. If you're wanting a string with spaces, enclose them in quotes to get a single argument, e.g., long filenames with spaces:
someprog.exe /v /n:5 "c:\my program data\my file data.txt"
The above yields 3 arguments passed to someprog.exe, plus somearg.exe itself. arg0 = someprog.exe arg1 = /v arg2 = /n:5 arg3 = c:\my program data\my file data.txtIan Mariano - http://www.ian-space.com/
"We are all wave equations in the information matrix of the universe" - me -
Oh yeah. If you're wanting a string with spaces, enclose them in quotes to get a single argument, e.g., long filenames with spaces:
someprog.exe /v /n:5 "c:\my program data\my file data.txt"
The above yields 3 arguments passed to someprog.exe, plus somearg.exe itself. arg0 = someprog.exe arg1 = /v arg2 = /n:5 arg3 = c:\my program data\my file data.txtIan Mariano - http://www.ian-space.com/
"We are all wave equations in the information matrix of the universe" - me