Log in

View Full Version : Hi and a Question


Nick Bischoff
09-24-2002, 01:25 AM
Hey there,

Nick from the gamedev.net business forum.

Just wanted to say, YO. But I also have a question,
in C or Cpp how do I read a command line arguement?
as in Getdata.exe -value
Now I need that value. I looked around the net and read up in several books but I cant seem to find any mention of it. This may not be the place for this, so if it isn't then lock away.

gautam
09-24-2002, 03:03 AM
Hi,

This is how you read a command line arguement.


int main(int argc, char *argv[])
{
// the program name GetData is argv[0] and the
arguments are argv[1], argv[2] and so on

if(argc > 1 && argc < 3)
int data = atoi(argv[1]);

// do something with data

return 0;
}

Nick Bischoff
09-24-2002, 09:57 PM
Thanks :)