I direct you to Kernighan & Ritchie exercise 7.1
Write a program that converts upper case to lower case or lower case to upper case depending on the name it is invoked with,...
How can I invoke the same program with different names?
I am using Linux, so I am invoking a compiled program just by entering:
$./a.out
What should I be doing differently?
You should create a symbolic link, or just copy the executable of course:
Either
$ ln -s a.out A.out
or
$ cp a.out A.out
Then in your program's main()
, inspect argv[0]
to figure out how to act. This is a pretty useful technique, actually used often by production software.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With