Skip to main content
gamedev.net
🔒 Locked

command line parameters

Started by amish1234 1 reply 200+ views
Original Post
amish1234
amish1234
How do I make a console application that takes command line parameters? Currently I have this:
void main(char filename[])
{
  cout << "command line param is: " << filename << endl;
}
However, filename is NULL. I am using Visual Studio.NET. I thought I''d seen it done before in this way. ___________________________________________________________ Proceeding on a brutal rampage is the obvious choice. Where to find the intensity (Updated Jan 23, 2004)
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
Nervo
Nervo
hey...You need to use the parameters:

int main(int argc, char** argv)

the names are arbitrary but the types are not.

argc is the number of arguments sent plus one and argv contains them in the array.

[edited by - nervo on January 31, 2004 11:11:05 PM]
Well, R2D22U2..
aftermath
aftermath
Use getopt to work with command lines.
Rate me up.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.