Results 1 to 7 of 7

Thread: IP address find

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 66 Times in 62 Posts

    Default Re: IP address find

    u r executing commands using QProcess the wrong way

    try this:
    Qt Code:
    1. QString prog = "/bin/bash";//shell
    2. QStringList arguments;
    3. arguments << "-c" << "ifconfig eth0 | head -n 2 \ | sed 'N;s/\n/ /;N;s/\n/ /' | awk '{print $7 " " $9 " " $5}' \ | sed -e 's/addr://g' -e 's/Mask://g'";
    4. QProcess* process = new QProcess(this);
    5. process->start(prog , arguments);
    6. process->waitForFinished();
    7. QString tmp = process->readAll();
    8. qDebug() << tmp;
    To copy to clipboard, switch view to plain text mode 

    like this, u can run any command that u can run on a normal shell. just change the second argument in the "arguments" stringlist.. if it doesnt work, break commands and see if the results are right and then move forward..hopefully, this will work anyway

  2. The following user says thank you to talk2amulya for this useful post:

    kpmsivachand (21st February 2009)

Similar Threads

  1. problems installing Qt opensource with msvc2008 support
    By odin1985 in forum Installation and Deployment
    Replies: 6
    Last Post: 24th May 2008, 09:06
  2. GCC can't find QSqlDatabase!!
    By brevleq in forum Qt Programming
    Replies: 5
    Last Post: 29th October 2007, 07:05
  3. Unable to resolve the IP address. ( Qt 3.)
    By joseph in forum Qt Programming
    Replies: 18
    Last Post: 5th July 2007, 12:02
  4. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.