slyer66 miniblogs

  • slyer66
    0

    C valoda.Kā dabūt vienam child procesam apakš procesu, ņemot vērā ka iepriekšējais process ir lielāks un atgriežas pie iepriekšējā.
    Pagaidam kods ir šāds:

     <stdio.h> 
    <stdlib.h> int main ()
    {
    int pid, pid3,pid4, status, died;
    switch (pid = fork())
    {
    case -1: printf("Can't fork\n");
    exit(-1);
    case 0:
    printf("I am a child\n");
    exit(3);
    default: died = wait(& status);
    }
    printf("Child was %d\n",pid);
    printf("%d died\n",died);
    printf("Exit value %d\n",status >> 8);
    printf("Exit status %d\n",status >> 7); switch (pid3 = fork())
    {
    case -1:
    printf("Can't fork\n");
    exit(-1);
    case 0:
    printf("I am a child3\n");
    exit(5);
    default: died = wait(& status); }
    printf("Child was %d\n",pid3);
    printf("%d died\n",died);
    printf("Exit value %d\n",status >> 8);
    printf("Exit status %d\n",status >> 7); exit(0);
    }
    • NoTitsNoFun
      0

      Uzraksti citu funkciju un piesauc kad vajag. Īsti nesapratu ko domāji ar procesu. Klase cita?

    • slyer66
      0

      Vairs nav aktuāli, atrisināju.

      • Normunds
        0

        Haha, šis bija ez uzdevums. 5min un palaida prom no lekcijas. biggrin_mini2.gif DD

    Atpakaļ Uz augšu