• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

Visual Studio Help

Hi, I am new to Visual Studio as I have been compiling my code and executing it in unix/linux. This is a very stupid problem i have.. I have no idea how to pass in the command line argument for Main when I execute the program.
For example:
I have a piece of code goes like this
int main(int argc, char* argv[]) {
ifsteam infile;

I know how to compile it using Visual Studio .Net, but I dont know how to Execute it with a given argument to the main function.
Say maybe I want the argv[1] to be something like Myfile.txt
How to I pass that Myfile.txt to Visual Studio so that it would recognize it as if i were to type : Myprogram Myfile.txt

thanks a lot
  • 3
  • 2
1 Solution
Project - Settings - Debug. Write Myfile.txt in Program arguments edit box.
lordianoAuthor Commented:
I am using Visual Studio .NET
Hmm I dont see Project-settings...
Still Can't find that Program Arguments edit box thing...
Sorry, it was for Visual Studio 6. In .NET:

Right-click on the project name in Solution Explorer - select Properties. Select Configuration Properties - Debugging. Fill Command Arguments edit box.
lordianoAuthor Commented:
ahh, i see
hmm sorry 1 more question, How do i enter more than 1 command arguments? like myfile.txt and mynewfile.txt as argv[1], and argv[2]. Is it possible to do that?

thanks.. I will raise the point of this question because this is actually a new question.. this will be for AlexFM only.
Write number of arguments in the edit box:

file1.txt file2.txt

In this case argv[1] = "file1.txt", argv[2] = "file2.txt"
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now