我有一個C示例程序,我需要轉換爲C#,但我不知道如何。轉換C(叉系統)爲C#
這裏的示例代碼:
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
printf("--beginning of program\n");
int counter = 0;
pid_t pid = fork();
if (pid == 0)
{
// child process
int i = 0;
for (; i < 5; ++i)
{
printf("child process: counter=%d\n", ++counter);
}
}
else if (pid > 0)
{
// parent process
int j = 0;
for (; j < 5; ++j)
{
printf("parent process: counter=%d\n", ++counter);
}
}
else
{
// fork failed
printf("fork() failed!\n");
return 1;
}
printf("--end of program--\n");
return 0;
}
你到目前爲止嘗試過什麼? –
我已經嘗試過使用過程開始因爲它說它是相同的叉系統,即時新行業,所以我試圖問它 – lamayooooooow