Overclock.net - An Overclocking Community - Reply to Topic

Thread: fork script in c++ Reply to Thread

Register Now

In order to be able to post messages on the Overclock.net - An Overclocking Community forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Please enter a password for your user account. Note that passwords are case-sensitive.
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:


  Additional Options
Miscellaneous Options

  Topic Review (Newest First)
12-24-2005 06:23 PM
Mental when i try to compile this script

#include <sys/types.h>
#include <unistd.h>

pid_t fork(void);

pid_t pid;

switch (pid = fork())
case -1:
    /* Here pid is -1, the fork failed */
    /* Some possible reasons are that you're */
    /* out of process slots or virtual memory */
    perror("The fork failed!");

case 0:
    /* pid of zero is the child */
    /* Here we're the child...what should we do? */
    /* ... */
    /* but after doing it, we should do something like: */

    /* pid greater than zero is parent getting the child's pid */
    printf("Child's pid is %d\
i get an error in line 8 about the switch command. any ideas?
12-24-2005 09:36 AM
Mental thats sounds like it could be it cause im putting in normal functions and its not reccognizing them for some reason. do you know how i would get the libraries for Dev C++ installed? thanks
12-24-2005 09:33 AM
amped It could be that you don't have the libraries that the program includes. Make sure you have them all before you try to compile it.
12-24-2005 09:26 AM
Mental for some reason whenever i try to compile code i find on the internet it never works and i get atleast 10 error messages. that is how it should be able to be done right? im using Dev-C++ anybody got any ideas
12-24-2005 04:09 AM
zone Does this or this or this help or are they too trivial ?
12-24-2005 12:05 AM
Mental does anybody have an example of a fork script written in c++?

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off