Cant seem to figure this one out,,,, although I have been trying for several hours and cant seem to find any good examples on the WWW...

I am attempting to write a program that prints the command-line arguments
of a program...

I did find a example that gives the Name of the program and attemps to find
the argrments to print,,,,,, but does not seem to work...

AnyOne got some Ideas?????? :-O :-/

#include "stdafx.h"
#include <stdio.h>
#include <conio.h>


int _tmain(int argc, char* argv[])
{
	int i;  

	printf("This program is named %s.\n", argv[0]); 


	for (i = 1; i < argc; ++i)    

		printf("the argument #%d is %s\n", i, argv[i]);   

	getch();

	return 0;
}

I'm assuming you are using VC++ ? Go up to Project/"Your Proj Here Properties"/Configuration Properties/Debug/Command Arguments and put something for it to print out (separated by spaces).

If you're not using VC++ then just put some arguments after your exe name when you are running it. "myexe -parameter1 -parameter2" (you don't need the dashes in this case they're just for effect).

>>but does not seem to work...
What doesn't work? Do you get compiler errors? If yes then post the first few errors.

Answer given on another site...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.