please can anyone tell whether i can use command line arguments in c on windows xp
in the tutorial it was mentioned that dos and linux are command line os
is windows also a command line os
please can anyone tell whether i can use command line arguments in c on windows xp
in the tutorial it was mentioned that dos and linux are command line os
is windows also a command line os
start->run and type "cmd" and hit enter.
EDIT: you also want to know how to pass arguments via the command line?
Each argument is delimited by a space, so it's like
myprogram.exe argument1 argument2 etc...
then?
What do you mean then? That is how you pass arguments via the command line. To answer your question about windows being a command line OS. No it really isn't. The MSDOS in windows XP isn't a fully functional DOS, it's some kind of abstraction that supports minimal shell features.
the code for my program is this
Code:#include<stdio.h> #include<stdlib.h> int main(int argc,char *argv[] ) { printf("%d\n",argc); printf("%s",**argv); int c; scanf("%d",c); return 0; }
but when i do as u say it says 'hello.exe' is not recognized as an internal or an external command
are you starting c++ at main() arguments? there might be a lot more you want to learn first, i suggest going through some tutorials before doing this part.
not to mention you need to learn about software in general, and how to use the command line...
it's like wanting to be an astronaut and starting at the pilot seat of the space shuttle before anything else. (lol ok this analogy is extreme, but the contrast is too glaring to miss the point.)
Last edited by simpleid; 08-15-2007 at 08:00 AM.
I agree with simple but to be a sport:
Code:#include<stdio.h> int main(int argc,char *argv[] ) { int i; printf("There are %d arguments\n",argc); for (i=0; i < argc; i++) printf("%s ", *argv++); return 0; } /** OUTPUT ** * * >hello.exe one two three four * There are 5 arguments. * hello.exe one two three four * */
Last edited by keira; 08-15-2007 at 08:21 AM.