New Posts  All Forums:Forum Nav:

fork script in c++

post #1 of 6
Thread Starter 
does anybody have an example of a fork script written in c++?
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel P4 550 3.4GHz Intel ATI x800se 128mb 1GB DDR2 533, 1GB DDR2 667 
Hard DriveOSMonitorKeyboard
Maxtor 80GB x 2 Windows XP SP2 Dell 17' LCD Logitech G15 
PowerMouse
Dell stock Logitech MX518 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel P4 550 3.4GHz Intel ATI x800se 128mb 1GB DDR2 533, 1GB DDR2 667 
Hard DriveOSMonitorKeyboard
Maxtor 80GB x 2 Windows XP SP2 Dell 17' LCD Logitech G15 
PowerMouse
Dell stock Logitech MX518 
  hide details  
Reply
post #2 of 6
Does this or this or this help or are they too trivial ?
My System
(13 items)
 
  
CPUMotherboardOSMonitor
P4 630 3.0GHz Asus P5LD2-VM Windows XP Pro (SP2) Viewsonic VX-724 (LCD) 
PowerCaseMouse
Antec TruePower II 480W TT SViking (modded) Logitech G5 +TT Gamma Pad 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardOSMonitor
P4 630 3.0GHz Asus P5LD2-VM Windows XP Pro (SP2) Viewsonic VX-724 (LCD) 
PowerCaseMouse
Antec TruePower II 480W TT SViking (modded) Logitech G5 +TT Gamma Pad 
  hide details  
Reply
post #3 of 6
Thread Starter 
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
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel P4 550 3.4GHz Intel ATI x800se 128mb 1GB DDR2 533, 1GB DDR2 667 
Hard DriveOSMonitorKeyboard
Maxtor 80GB x 2 Windows XP SP2 Dell 17' LCD Logitech G15 
PowerMouse
Dell stock Logitech MX518 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel P4 550 3.4GHz Intel ATI x800se 128mb 1GB DDR2 533, 1GB DDR2 667 
Hard DriveOSMonitorKeyboard
Maxtor 80GB x 2 Windows XP SP2 Dell 17' LCD Logitech G15 
PowerMouse
Dell stock Logitech MX518 
  hide details  
Reply
post #4 of 6
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.
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6700 Kentsfield DFI DK P35-T2RS eVGA 9800GTX 512MB G.SKILL DDR2-800 4x2GB 
Hard DriveOptical DriveMonitorKeyboard
160GB WD SATA2 Pioneer DVD-ROM Acer 22 in. Saitek Eclipse II 
PowerCaseMouse
PC Power & Cooling 750W Antec P182 Logitech MX518 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6700 Kentsfield DFI DK P35-T2RS eVGA 9800GTX 512MB G.SKILL DDR2-800 4x2GB 
Hard DriveOptical DriveMonitorKeyboard
160GB WD SATA2 Pioneer DVD-ROM Acer 22 in. Saitek Eclipse II 
PowerCaseMouse
PC Power & Cooling 750W Antec P182 Logitech MX518 
  hide details  
Reply
post #5 of 6
Thread Starter 
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
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel P4 550 3.4GHz Intel ATI x800se 128mb 1GB DDR2 533, 1GB DDR2 667 
Hard DriveOSMonitorKeyboard
Maxtor 80GB x 2 Windows XP SP2 Dell 17' LCD Logitech G15 
PowerMouse
Dell stock Logitech MX518 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel P4 550 3.4GHz Intel ATI x800se 128mb 1GB DDR2 533, 1GB DDR2 667 
Hard DriveOSMonitorKeyboard
Maxtor 80GB x 2 Windows XP SP2 Dell 17' LCD Logitech G15 
PowerMouse
Dell stock Logitech MX518 
  hide details  
Reply
post #6 of 6
Thread Starter 
when i try to compile this script

Code:
#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!");
    break;

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: */
    _exit(0);

default:
    /* pid greater than zero is parent getting the child's pid */
    printf("Child's pid is %d\
",pid);
}
i get an error in line 8 about the switch command. any ideas?
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel P4 550 3.4GHz Intel ATI x800se 128mb 1GB DDR2 533, 1GB DDR2 667 
Hard DriveOSMonitorKeyboard
Maxtor 80GB x 2 Windows XP SP2 Dell 17' LCD Logitech G15 
PowerMouse
Dell stock Logitech MX518 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel P4 550 3.4GHz Intel ATI x800se 128mb 1GB DDR2 533, 1GB DDR2 667 
Hard DriveOSMonitorKeyboard
Maxtor 80GB x 2 Windows XP SP2 Dell 17' LCD Logitech G15 
PowerMouse
Dell stock Logitech MX518 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming