السلام عليكم
إخواني عندي برنامج في السي بلس بلس
ما أدري إيش عمله بالضبط
هذا هو
#include <iostream>
#include <unistd.h>
#include <sys/wait.h>
main()
{
int forkresult;
cout<<getpid()<<":Is the parent process.\n"<<endl;
cout<<getpid()<<": and I am going to fork...\n"<<endl;
if( (forkresult = fork() )>0 )
{
cout<<getpid()<<": My child's pid is: "<<forkresult<<endl;
wait( NULL );
}
else
if( forkresult == 0 )
{
cout<<getpid()<<": Hi! I am the child. My parent's id is: "<< getppid()<<endl<<endl<<endl;
execlp("ls", "ls",NULL);
}
else
cout<<"Error"<<endl;
cout<<"\n\n\n"<<getpid()<<": So this whom?"<<endl;
}لما أعمل له رن يطلع لي إيرور
c:\documents and settings\f\desktop\cpp1.cpp(2) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
أتوقع إني أحتاج ملفات
'unistd.h'
و
'sys/wait.h'
لأنها مش عندي في الإنكلود تبع السي بلس بلس
فـ الله يجزاكم خير
اللي عنده هالملفين
ينزل لي إياهم
دورتهم في النت ما لقيتهم
لقيت حكي عنهم بس لكن كملف كامل أنزله ما لقيت