Trick To Make Your Program Name Constant

If you are an egoistic programmer, then i m sure you want your programs to identify yourself. You hate when someone even renames it to his/her name :P. Even when you are storing something in your EXE itself it's very important that your program has an unique and constant name. Here's a trick to make your program name constant.



Image source from internet

Here's the C code Logic to do that :-


#define appname "myapplication.exe"   // Set your application name
void main(int arc,char *argv[0])
{
/* Code for constant name */
remove(appname);
rename(_argv[0],appname);

/* Your Application code */

}



Comments

Popular Posts