PDA

View Full Version : How to assign IP address to eth0 in QT



csw00700
7th February 2011, 08:40
Hi.
I would like to assign Ip address to eth0 which is not assigned IP address in QT

is this possible?

generally

#ifconfig eth0 192.168.121.1 up

I would like to make a code like above function in Qt

Help me..:)

squidge
7th February 2011, 09:16
Use QProcess to execute the above command ?

csw00700
7th February 2011, 09:43
No.

I would like to make code Using Network classes

mcosta
7th February 2011, 10:44
simply, you cannot.

this task is not platform independent, so you have to use Native APIs or QProcess to launch external program

squidge
7th February 2011, 14:31
No. I would like to make code Using Network classes

As stated, the network classes do not support this.

If you require this functionality in code (rather than just executing the said application), you could always include the code from ifconfig source (but of course, this would mean you must not license your application under a more restrictive license than ifconfig itself)