Cell Phone Software Forum
| View previous topic :: View next topic |
| Author |
Message |
Arturo Guest
|
Posted: Sun Mar 25, 2007 4:28 am Post subject: C/C++ Linux |
|
|
Hey All,
Wondering if anyone can help me. I am working on an assignment for an
OS class. The assignment requires that I write code that will create 4
child processes, "producer", "filter1", "filter2", and "consumer". The
"producer" will read data from an input text file (line by line),
"filter1" will replace all " " with "*", "filter2" will replace all
"CAPS" with "LOWERCASES" and the consumer will append the new modified
data to a new output text file (this must be done line by line). I am
suppose to use pipe() to allow each process to pass data to the next
process. The picture is simply straight forward and clear, producer
reads a line, passes it to filter1; via pipe, who does his job and
then passes the new modified line to filter2; via pipe, who does his
job and then passes the new modified line to the consumer, via pipe;
who finally outputs the new modified line in a text file. This process
is repeated until the input file is completely modified. Very simple,
however, I need to specifically use: vfork(), wait(), exit(), and
pipe(). I read up on this stuff and it seems straight forward but I am
having a difficult time making it all work. Can someone please atleast
just give me a hint or some guidance on how I should approach this
problem.
Thanks,
Art |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Phlip Guest
|
Posted: Sun Mar 25, 2007 4:36 am Post subject: Re: C/C++ Linux |
|
|
Arturo:
| Quote: |
Wondering if anyone can help me. I am working on an assignment for an
OS class.
|
Tip: Break text up into paragraphs, to make it easier to read.
| Quote: |
The assignment requires that I write code that will create 4
child processes, "producer", "filter1", "filter2", and "consumer". The
"producer" will read data from an input text file (line by line),
"filter1" will replace all " " with "*", "filter2" will replace all
"CAPS" with "LOWERCASES" and the consumer will append the new modified
data to a new output text file (this must be done line by line).
|
And you have written a scratch project that uses tolower and toupper on its
STDIN and STDOUT first, right?
| Quote: |
I am
suppose to use pipe() to allow each process to pass data to the next
process. The picture is simply straight forward and clear, producer
reads a line, passes it to filter1; via pipe, who does his job and
then passes the new modified line to filter2; via pipe, who does his
job and then passes the new modified line to the consumer, via pipe;
who finally outputs the new modified line in a text file. This process
is repeated until the input file is completely modified. Very simple,
however, I need to specifically use: vfork(), wait(), exit(), and
pipe(). I read up on this stuff and it seems straight forward but I am
having a difficult time making it all work. Can someone please atleast
just give me a hint or some guidance on how I should approach this
problem.
|
Post a sample of your code (containing a confession it is homework) to a
newsgroup with Linux and C in its name. This newsgroup covers generic
things, so you might get less than ideal results here!
--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!! |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Arturo Guest
|
Posted: Sun Mar 25, 2007 9:43 pm Post subject: Re: C/C++ Linux |
|
|
On Mar 24, 8:36 pm, "Phlip" <phlip...@yahoo.com> wrote:
| Quote: |
Arturo:
Wondering if anyone can help me. I am working on an assignment for an
OS class.
Tip: Break text up into paragraphs, to make it easier to read.
The assignment requires that I write code that will create 4
child processes, "producer", "filter1", "filter2", and "consumer". The
"producer" will read data from an input text file (line by line),
"filter1" will replace all " " with "*", "filter2" will replace all
"CAPS" with "LOWERCASES" and the consumer will append the new modified
data to a new output text file (this must be done line by line).
And you have written a scratch project that uses tolower and toupper on its
STDIN and STDOUT first, right?
I am
suppose to use pipe() to allow each process to pass data to the next
process. The picture is simply straight forward and clear, producer
reads a line, passes it to filter1; via pipe, who does his job and
then passes the new modified line to filter2; via pipe, who does his
job and then passes the new modified line to the consumer, via pipe;
who finally outputs the new modified line in a text file. This process
is repeated until the input file is completely modified. Very simple,
however, I need to specifically use: vfork(), wait(), exit(), and
pipe(). I read up on this stuff and it seems straight forward but I am
having a difficult time making it all work. Can someone please atleast
just give me a hint or some guidance on how I should approach this
problem.
Post a sample of your code (containing a confession it is homework) to a
newsgroup with Linux and C in its name. This newsgroup covers generic
things, so you might get less than ideal results here!
--
Phlip
http://www.greencheese.us/ZeekLand<-- NOT a blog!!!
And you have written a scratch project that uses tolower and toupper on its
STDIN and STDOUT first, right?
|
I'm not sure what you mean by "scratch project", but I am using
islower(), tolower() and isupper(), toupper to manipulate the ASCII
values.
| Quote: |
Post a sample of your code (containing a confession it is homework) to a
newsgroup with Linux and C in its name. This newsgroup covers generic
things, so you might get less than ideal results here!
|
Thanks |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|

212 Attacks blocked
Powered by phpBB © 2001, 2005 phpBB Group
|