• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 378
  • 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;
infile.open(argv[1]);
infile.close();
}

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
0
lordiano
Asked:
lordiano
  • 3
  • 2
1 Solution
 
AlexFMCommented:
Project - Settings - Debug. Write Myfile.txt in Program arguments edit box.
0
 
lordianoAuthor Commented:
I am using Visual Studio .NET
Hmm I dont see Project-settings...
Still Can't find that Program Arguments edit box thing...
0
 
AlexFMCommented:
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.
0
 
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.
0
 
AlexFMCommented:
Write number of arguments in the edit box:

file1.txt file2.txt

In this case argv[1] = "file1.txt", argv[2] = "file2.txt"
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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