Pass Command Line Argument in Turbo C++
The following are the steps to execute a program with Command Line Argument inside Turbo C & C++ Compiler.
1. Open Turbo C++ Compiler
Open Turbo C++. If you don't have, you can download Turbo C++ Compiler form here.
2. Write a Program
Following is a simple example which checks if there is any argument supplied from the command line and take action accordingly.
3. Compile & Run Program
When this code is compiled and executed by Turbo C++ Compiler, it produces the following result.
one argument expected.
4. Open DOS Shell
Now open Turbo C++ File Menu ( Shortcut to open ALT + F) and select the DOS Shell option.
5. Change Directory
Now you need to change the current directory of DOS Shell to "SOURCES" from "BIN", for this you need to user cd.. command.
- First, use cd.. for coming back to Turbo C++ main directory.
cd..
- Now use cd SOURCE to access the source directory.
cd SOURCE
6. Execute Program with Command Line Argument
ARGS.EXE testing
Here ARGS.EXE is the executable of your program ARGS.C and testing is a Command Line Argument. When you'll hit the enter, it produces the following result.
The argument supplied is testing
Command Line
Pass Argument
Software Solution
Turbo C++
Turbo C++ Issue Solution
Turbo C++ Problems Solve
Turbo Cpp