i'm trying to use fork() join() and wait() but my compiler says "fork underclaired (firts use this function)"
what is wrong?
and which headers files do i need to fork processes ??
thanx and sorry for the stupid question :)
Printable View
i'm trying to use fork() join() and wait() but my compiler says "fork underclaired (firts use this function)"
what is wrong?
and which headers files do i need to fork processes ??
thanx and sorry for the stupid question :)
Presumably you're on a unix system, so you can just check the man pages, possibly with sections, as in "man 2 wait" or "man 3 wait", depending on how your system is set up.
Although since there is no standard join() function which I'm aware of (certainly not one that works in conjunction with fork()), you might be on another system, in which case you'd want to consult its documentation; or at least mention what OS it is.
If, for some reason, you haven't got any man pages, just do a search for man pages; there are loads of them online, and if they're from a mainstream unix-like OS, the general description will probably be good enough for you.
The headers you probably need are:
Code:#include <sys/types.h>
#include <unistd.h>
thanx guys
i'm using winXP and dev++ compiler
is there any way to declare these function in a header file?
or can i find on the web the header files i need??
thanx again
Not sure what you are trying to do, but fork() is a unix/linux system call. There is, as far as I know, no "join" system call. There is a wait() function that relates to fork().
Now, if you are doing this in Windows, you won't find a fork() call.
Also, you need to include the right header file, which is unistd.h in most OS's.
Edit: To slow...
You can use cygwin, or start thinking of a different solution.
--
Mats
fork() is a *nix function. It exists in OSs such as Linux, FreeBSD, etc... basically everything except Windows, which has no real equivalent to fork().
Tell us what you're trying to do - there's probably a better solution.
i study operating systems for my university and i found some codes with fork() and wait() and i tryed to execute them on my winXP pc. But i have these problems. Sorry but i didn't knew that i should run on UNIX like systems. From your posts i see that i can't do it on winXP
Try
Cygwin Information and Installation
--
Mats
Install cygwin, and run them that way. Cygwin Information and Installation
Quzah.
Two votes for Cygwin... Must be a winner.
Just beware that the fork isn't a REAL fork - it's a simulated fork. It's pretty close to the real thing, but since Windows can not do fork, Cygwin works out something that is pretty close. It won't work in ALL situations where fork in a Unix system works. But you probably have to do some pretty complicated/unusual things to discover those bits.
--
Mats
thanx guys for your attension :)