1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help with C program(gcc) in Linux

Discussion in 'C' started by b0b0#32, Oct 17, 2009.

  1. b0b0#32

    b0b0#32 New Member

    Joined:
    Oct 17, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi... I have a project for my college but unfortunately, I struggle in programming, apart from simple C programs. Anyway, the way I see it I think the code I need should be around 20-30 lines, so if somebody can provide me some help I"ll be really grateful. Here is the project:

    -A process Parent will produce 10 random integer numbers (rand).
    -Then the process Parent will produce (fork) 2 processes Children.
    -The processes Children will print their PID (getpid) and will sort (qsort, as <stdlib.h>) the integer numbers, the one in ascending order and the other in descending.
    -The sorted tables will be printed at stdout with the use of write.
    -The process Parent will standby (waitpid) until the processes Children finish their execution.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Best help we can give you is to help you do this project yourself. If we just give you the code then you learn nothing.

    So what code have you got so far? Have you at least got the first bit done, where the program produces 10 random numbers and stores them somewhere?
     

Share This Page