Whta is command line arguements
wht is the use of it?

See All Responses Below...
Author
Message Rating
Posted on: 05/06/2012
Command line arguments are used to pass value to a program straight form the console using the arguments indicated in line below in bold..

int main(int argc, char* argv[])
{
printf("Hello World! ");
return 0;
}

Tom

Posted on: 05/06/2012

In some cases, the application may need some initial value(s) for the proceeding. In that situation, the command line  argument feature is helpful. So, the entry point of the application can access such values, if any

Example:
static void Main(string[] args){ 
for (int i = 0; i < args.Length; i++){
Console.Write(i.ToString ());
}}

Execute the program:
PgmName.exe name1 name2 name3

Then the output will be:
name1
name2
name3

Share this page across other social networking sites



Please Login to Post Your Comments
Name (Max. 100 characters)
Please post your comments here
Select Language
Comments
Attach File(Max. Size: 2 MB)
A few simple rules when posting your Comments,
  1. Please post only answers relevant to the topic of discussion.
  2. Please dont misuse this site or do not be abusive, offensive, inappropriate,harass anyone on the boards or post ads or spam. Doing so will delete your inappropriate messages and will block or delete your account on this site.