View Single Post
  #3   (View Single Post)  
Old 11th November 2011
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

For bonus points, you might also want to consider how your program could be written as a shell script. After all, the logic of your program is simply manipulating some strings followed by spawning another shell to execute a constructed command.

The problem with many professional C programmers (especially if they only have proficiency in the one language...) is that they think that everything can & should be written in C. While it is true that C is flexible enough to handle general usage, it may not be the most advantageous choice. Scripting has its place, & many scripting languages have special facilities for handling string manipulations far more flexibly than C. Yes, shell scripts are limited to what can be spliced together via sed(1), grep(1), awk(1), etc., the newer scripting languages such as Perl, Python, & Ruby excel at string manipulations. Learning regular expressions can be a very useful tool in your ever-expanding bag of tricks.
Reply With Quote