Is this possible in C++ ??

Hello,

Is is possible to print a message cout << "success" after successful compilation of a program..?

I actually want to give user the options to do various things for which user should pass runtime arguments.

But the obvious question is how the hell end user going to know the format of passing runtime arguments..So after compiling the program I want to print message that this this is the format you should run the program in..
No. Can't you give the user instructions if he fails to pass the correct arguments? Many programs work like that. Take grep for instance.
$ grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.

Yes, that can be done easily. But my user is going to compile the program everytime he is going to use it.. so why should I fail him even once? Isn't it my responsibility to acknowledge him how to use my program..?

I was wondering if I need to edit the compiler. See its going to generate executable. So just after that executable is created it will just accept few things from my program and print it as it is.

Or another way I thought, the directory in which that executable is put, in unix, is also a file. So can I edit that file (directory file) to just accept arguments which it will echo.

I need you guys help to do this, as i'm new to cpp.
You can do this in the makefile, using echo. You just need to keep the @echo at the end of the target.
could you please elaborate whatever you said Biju Scaria , I mean how exactly it can be done..?

Thanks in Advnace
How do you compile your program?
Could you please copy exact line that runs compiler?
well my program compilation is quite normal like g++ filename.cpp
what is important for me is how to run executable created by source code which isrun like


sort.o filename sorting_algorithm_name output_on
is the general format to run the program

and a general example sort.o input.txt heap output.txt

note that output_on can be anything...from terminal to mailing the output (i use mail command of unix for this).

So after compiling i would want the message on the terminal like
general format to run the program is: sort.o filename sorting_algorithm_name output_on
witth some options.

Please read something about Makefiles: http://en.wikipedia.org/wiki/Make_%28software%29
Makefiles is default way to compile software on g++ on Linux, and it could solve your problem.
Topic archived. No new replies allowed.