-
February 3rd, 2006, 08:55 PM
#1
Senior Member
Command Line Arguement
hi
I m creating a C++ program in Visual C++ 6.0 based on file handling!!
What I want to do is, I want the user to mention the file name during the command line thing!!
i..e if the user types: cl problem1 history.txt
My program opens the history.txt file in reading mode.
The thing is how do I, take this filename as arguement in my program!!
thnx
-
February 3rd, 2006, 09:21 PM
#2
Search your help files for ARGV and ARGC... That'll point your nose in the right direction
Oliver's Law:
Experience is something you don't get until just after you need it.
-
February 3rd, 2006, 09:32 PM
#3
Senior Member
hi SirDice
thnx for putting me on the right direction!!
Now, I have created a C++ program in Visual C++ 6.0.
Can u tell me the exact steps that I need to take, so as to be able to execute my program thru the command line.
Thnx
-
February 3rd, 2006, 09:33 PM
#4
Step 1 - Learn to use google
Step 2 - Learn C++
Parsing out arguments given via the command line is usually one of the first few chapters of any book on c++ programming. Finding a tutorial on doing it should be trivial via google.
"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chsh
Blog of X
-
February 3rd, 2006, 09:42 PM
#5
I thought Visual C++ would have had plenty of examples on how to use argv and argc.. but anyway.. google throws up plenty indeed.. first hit http://www.google.com/search?hl=en&l...2B&btnG=Search
Oliver's Law:
Experience is something you don't get until just after you need it.
-
February 3rd, 2006, 10:18 PM
#6
Senior Member
thnx all of u for the above assistance.
SirDice, the link really helped, thnx a lot!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|