The code is designed to perform the following steps:
1. Taking in the file name as a command line argument.
2. Check if the file, the user wants to creates already exists. If it does just open the file using
and if it doesn't, proceed to the next steps.
3. At this point of time we need to have a standard template file(mine is called startupC), the content of which will be copied to the new file using filehandling API's of C. While filling up the new file, the entries to the author and time fields are done by the code itself. The current time of the system is obtained using time() and ctime() functions.
4. After the completion of the code a executable file is to made. My c file name was viC.c and the executable file was named vic.
$cc -g -Wall viC.c -o vic
5. Then, I copied 'vic' to the standard folder /usr/bin and the standard template file to a self made directory /usr/files/
Now that we are done with the dirty work our own command is ready. Use the command:
and voila! you own C file template with you name on it!