Link to home
Create AccountLog in
Avatar of HKComputer
HKComputerFlag for United States of America

asked on

Recieving parameters on the command line

I'm trying to program a very elementary program (to work with another software vendors program) that needs to be able to accept two parameters from the command line.  

The instructions I have from the software vendor say: When [TheirSoftware] 'calls' or invokes [MyProgram], it passes two parameters on the command line.  The first parameter is the exact name and path of the [first text file generated by TheirSoftware] and the second paraemter is the exact name and path of the [text file to be passed back to TheirSoftware].

So my program will be invoked like this:

MyProgram c:\somedirectory\original.txt c:\somedirectory\new.txt

How do I read or use the parameters that are being passed to MyProgram?
SOLUTION
Avatar of appari
appari
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of HKComputer

ASKER

I believe that all three of the above answers are correct.  I found the last one the easiest to understand and therefore I used it.  Thanks for you help.