Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Visual Studio Help

Posted on 2003-11-13
5
Medium Priority
?
376 Views
Last Modified: 2010-04-01
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
Comment
Question by:lordiano
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 9738943
Project - Settings - Debug. Write Myfile.txt in Program arguments edit box.
0
 

Author Comment

by:lordiano
ID: 9738973
I am using Visual Studio .NET
Hmm I dont see Project-settings...
Still Can't find that Program Arguments edit box thing...
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 1600 total points
ID: 9738979
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
 

Author Comment

by:lordiano
ID: 9739003
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
 
LVL 48

Expert Comment

by:AlexFM
ID: 9739047
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question