alternately writings


 
Thread Tools Search this Thread
Top Forums Programming alternately writings
# 1  
Old 07-05-2004
alternately writings

Hi,

can anyone show me how to solve the following exercise in ANSI C?

Create 2 process (parent & child).

The parent have to create a file called file<pid>, where <pid> is the process ID of the child process.

For n times (where n is a constant previously defined) the child process and the parent process alternately write in file<pid> a sentence (like "I'm the child" or "I'm the parent") and their process ID.

After n writings the parent process write in file<pid> the termination status of child process.

I hope you understand.. It's so important, please help me!

Thank's!
# 2  
Old 07-05-2004
I'm sorry, we won't do your homework. See point 6 of the rules:

https://www.unix.com/unix-for-beginners-questions-and-answers/2971-simple-rules-unix-com-forums.html

Ask your teacher if you're stuck. (and buy ``Advanced Programming in the UNIX Environment'' by Richard Stevens.)

On a side note, ANSI C does not have the concept of processes. Therefore, what you want is presumably a POSIX or UNIX solution.
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed search alternately for patterns

hi all, I am trying to do search on a gzip file. The file has <pattern1> Data.. <pattern2> data <pattern1> data <patter2> I want to print each pattern 1 and the corrresponding pattern2. If pattern 2 fails to appear and pattern 1 appears, I do not want to print pattern1 and... (3 Replies)
Discussion started by: baskar123
3 Replies
Login or Register to Ask a Question