Thread: System function Call - Nowait possible - linux environment?

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    3

    Question System function Call - Nowait possible - linux environment?

    Hi ,

    This is not homework! Its a simple question about system calls on linux systems.

    If I run a system command such as this:
    Code:
    #include <string>
      
    int main()
    {
      std::string app_string("gedit");
      system( app_string.c_str() );
      return 0;
    }
    It works perfectly fine, but my app waits for the user to terminate example:gedit before the program continues its main loop.

    What I am looking for is the correct method to call another executable and not wait for it to terminate, just continue the main loop.

    Is this possible with this command? or any other command for that matter.

    Thanks in advance

  2. #2
    Registered User
    Join Date
    Oct 2009
    Posts
    3
    Argh after weeks of trying , I posted then in minutes worked out the answer.

    For others the answer is yes in linux enviroment with appending a & on the end of the shell string.

    I'll post how for those reading

    Code:
    #include <string>
      
    int main()
    {
      std::string app_string("gedit&");
      system( app_string.c_str() );
      return 0;
    }
    This works how I requested. Launches gedit and continues the main loop without waiting for an exit command.

    Thanks to those who may be investigating an answer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Recursive function
    By WatchTower in forum C Programming
    Replies: 11
    Last Post: 07-15-2009, 07:42 AM
  2. doubt in c parser coding
    By akshara.sinha in forum C Programming
    Replies: 4
    Last Post: 12-23-2007, 01:49 PM
  3. Help calling function is asm
    By brietje698 in forum C++ Programming
    Replies: 24
    Last Post: 12-06-2007, 04:48 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM

Tags for this Thread