Find the answer to your Linux question:
Results 1 to 2 of 2
I'm writing a CLI for an assignment (it's in C++). One of the things that we have to do is to start other programs from within our CLI. I've managed ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2004
    Location
    Dunedin, New Zealand
    Posts
    29

    '&' behaviour in CLI.


    I'm writing a CLI for an assignment (it's in C++). One of the things that we have to do is to start other programs from within our CLI. I've managed to do this, the traditional fork() and wait() does the job. I'm just curious to see if I can code the behaviour of the & in to the CLI. (The & allows the normal CLI to continue execution while the child process is in the middle of it's execution).

    Code:
    pid_t forked = fork();
    if(forked != 0){
        int status;
        wait(&status);
    }else{
        //execute the program
    }
    Is what I've got.

  2. #2
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Quoth the Forum Rules,

    Dont give us YOUR homework questions - Dont be so bloody lazy. If you post your homework for someone else todo, dont be supprised or get upset if your post is removed. Asking for a brief pointer on a *particular area* IS ok. Verbatim Copying of multiple assignment questions and attaching a note at the bottom saying "please help me" is not. We were all at school/college/uni once upon a time, and we know what homework questions look like
    Nevermore, please.
    Registered Linux user #270181
    TechieMoe's Tech Rants

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •