Author Topic: Turbo C command line arguments syntax usage  (Read 1542 times)

kathir

  • Administrator
  • Sr. Member
  • *****
  • Posts: 283
Turbo C command line arguments syntax usage
« on: November 28, 2011, 06:15:37 pm »
The syntax to use the command line argument is given below with example:

Code:
//Source Code Listing


// cmdtest.c source file

#include <stdio.h>

void main(int argc, char *argv[])
{
   int i = 0;
   for(i = 0; i < argc; i++)
   {
      printf("\nargument[%d] = %s", i + 1, argv[i]);
   }
}

output:
c:\>cmdtest.exe hello world

argument[1] = c:\cmdtest.exe
argument[2] = hello
argument[3] = world

 


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1