Please refer to the attached ifconfig.c file coming from net-tools package.
Please refer to set_ifstate function regarding how to set IP address with socket programming.
Have a great day,
Yiping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------