On 2005-02-16 10:01 -0800, [EMAIL PROTECTED] wrote: > iam new to linux...iam doing a project in linux ....for my project > iam supposed to get ip addresses dynamically and block or unblock > them ....i have to do this using C program.....i tried using > System() ...but i didnt know how to change the ip address > dynamically...
What does System() do? I am familiar with the system(3) C library function, which is one way to pass a command to a shell (exec(3) and family is another way), but have never heard of System() despite years of programming off-and-on in C. Anyway, there are basically two ways to do what I suppose it is you want to accomplish (update the kernel's firewall settings): you can either modify the kernel IP firewalling tables directly, or you can call an external utility that does that same thing. In this case the source code for that utility is also available, so incorporating the necessary functionality into your own code should be fairly trivial. If you want to know how to change the IP address of an interface (which is what your statements trail off into nothingness from), look at the source code for tools that allow you to do that, such as dhcpcd or ifconfig. -- Michael Kj�rling, [EMAIL PROTECTED] - http://michael.kjorling.com/ * ASCII Ribbon Campaign: Against HTML Mail, Proprietary Attachments * * No bird soars too high if he soars with his own wings. -*- SM0YBY * To unsubscribe from this list, please email [EMAIL PROTECTED] & you will be removed. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/LINUX_Newbies/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
