Gappa Gappa - 6 months ago 170
Linux Question

how to get the network gateway address in Qt?

how to get the network gateway address in Qt?(linux)

I'm trying to get the gateway using the standard Qt library. I'm playing with QHostAddress, QNetworkInterface and so on but I cannot extract the gateway.

Do you have any idea?

Answer

I have parsed the route -n command to get the default gateway.