Ifconfig does not use /proc or something like that. It access the interface using ioctl and some other C libraries (direct access).
Why you do not use ifconfig ? Btw, to change the gateway you need access to the routing table.. Why do not use the available tools for that? Like "ifconfig", "route", etc ?