I program with dev c++ and I know that there is a function that lets me use command prompt commands in a C program. What is this function?
Using command prompt commands in C programming?
operating system commands can be done by the exec*() and spawn*() function family.
command line input is captured thusly:
int main(int argc, char *argv[])
{
printf("This should print the last cmd line arg: %s\n,"
argv[argc-1]);
... or ...
cout %26lt;%26lt; "This should print the last cmd line arg: " %26lt;%26lt; argv[argc-1] %26lt;%26lt; endl ;
}
Reply:are you talking about arguments? If so, its args[x]
where x represents the arg you are referencing.
Actually, this is how you do it in JAVA, so it may be different for what you need.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment