Results 1 to 9 of 9

Thread: Check for running applications in linux using Qt

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Check for running applications in linux using Qt

    Yes these tools are always there for me to.

    On Windows there is no /proc also.
    On the MacOsX is sysctl with is better then parsing /proc (and strictly speaking MacOSX is not Linux it's Unix - question was regarding Linux).

    IMHO on Linux I would go with parsing the /proc(fs), safer.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Check for running applications in linux using Qt

    Quote Originally Posted by Talei View Post
    Yes these tools are always there for me to.

    On Windows there is no /proc also.
    On the MacOsX is sysctl with is better then parsing /proc (and strictly speaking MacOSX is not Linux it's Unix - question was regarding Linux).
    That's right.

    Quote Originally Posted by Talei View Post
    IMHO on Linux I would go with parsing the /proc(fs), safer.
    I totally agree with you point, but I think it's gonna be hard to implement for topic-starter
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Check for running applications in linux using Qt

    IMHO reading /proc is easier, for example (pseudo code, not correct but gives the basic idea):

    Read /proc: QFile().open(fileName) -> QByteArray ba = QFile().readAll(); -> parse(ba);
    Process: QProcess().start(FileName/command) -> slot ReadyRead() -> QByteArray ba = QProcess().readAll(); -> parse(ba);

    Reading /proc don't involve signal/slot mechanism (and, to clarify here, I don't take into account blocking QProcess() because that's just bad programming IMHO, for this problem at least).

    And with blocking QPRocess: QProcess().start(command) -> QProcess().waitForFinished() -> QByteArray ba = QProcess().readAll();. Same as reading /proc.

    Maybe this will help topic starter to get basic idea about possibilities (practically he already has ready solution).

    EDIT:
    I forgot actual parsing and with correct command parsing would be reduced to splitting by the new line, so indeed that would be easier to manage/implement .
    Last edited by Talei; 28th August 2012 at 12:33.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

Similar Threads

  1. Replies: 0
    Last Post: 13th February 2012, 06:44
  2. Replies: 5
    Last Post: 22nd May 2011, 22:38
  3. Problems running applications .exe
    By croussou in forum Installation and Deployment
    Replies: 8
    Last Post: 25th March 2011, 18:07
  4. Running Qt applications on windows
    By Maluko_Da_Tola in forum Newbie
    Replies: 2
    Last Post: 12th September 2010, 20:51
  5. running external applications via QT?
    By cruisx in forum Newbie
    Replies: 1
    Last Post: 11th August 2009, 06:34

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.