# Using argv[] with Windows

## Recommended Posts

I am programming a monopoly game that I will eventually compile on Linux, so I know how to use the argv[] in int main that way when I call the program. However, I am not sure how to send it the information in Windows while using Microsoft Visual. My array has 6 elements, should I use run? Right now I just click on the .exe, and I don't know how to send it information without a command line. Hope this makes sense, thanks for the help.

##### Share on other sites
Alright a few possibilities of what you are talking about :

In a windows application, you can have a separate entrance point compared to a traditional C or C++ application. It's called WinMain and it passes in the parameters in a different way to int main(). Visual Studio supports both types of entrance types, so WinMain and main(), if you have main() it'll be the same as what you'd expect in linux.

In terms of how to set the command line in Visual Studio for debugging, rather than going to the command line, right click on the project you are interested in, go to Debug options area, then type in the command lines under the command line area. This will then run your application with those command line parameters.

##### Share on other sites
Alternatively, you can just make a batch file that will pass the parameters and use that for testing.

##### Share on other sites
How would I do that?

##### Share on other sites
Create a text file and put lists of commands in it. Give it a .bat extension. When you click on it, Windows will run the commands!

rem this is a commentprog param1 param2 param3

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627662
• Total Posts
2978515

• 10
• 10
• 12
• 22
• 13