开发者

Calling shell scripts vs c functions

Certain small tasks seem to be much easier to accomplish via shell script then writing a small version of the utility that doesn't necessarily handle all edge cases in c(especially when a problem seems to fit the unix pipe/filter style).

On the other hand embedding she开发者_运维百科ll calls in c code seem ugly. Assuming fairly basic utilities/options(such as busybox) and not much need for portability what is a good rule of thumb?


Even just calling and communicating with an external program from C has a lot more corner cases and difficult-to-get-right issues than doing the task in C. It will also easily be as much as 100 times slower, and maybe worse. If you find yourself wanting to use shell utilities from C, then C is probably not the right language for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜