How to use sprintf instead of hardcoded values

Posted by astha goyal on Stack Overflow See other posts from Stack Overflow or by astha goyal
Published on 2010-03-20T10:52:14Z Indexed on 2010/03/20 11:21 UTC
Read the original article Hit count: 440

Filed under:
|
|

I am developing a firewall for Linux as my project. I am able to capture packets and to block them. I am using IPTABLES.

How can I use variables with sprintf instead of hardcoded values?

sprintf(comm, "iptables -A INPUT -s $str -j DROP")
// inplace of:
sprintf(comm, "iptables -A INPUT -s 192.168.0.43 -j DROP")

© Stack Overflow or respective owner

Related posts about c

    Related posts about printf