0

hi.......We have a task to write a program in C in linux environment that takes 2 command line arguments:
1.the name of a text file that contains single-digit integer data in one line
2.an integer to be searched from the sorted version of data in file.

The prgram creates a child process that reads the text file paased as the first argument,sorts the numbers with any sorting algo,communicates the sorted numbers to parent process via a pipe and exits.The parent process searches the sorted data that it receievs from the child and displays a message informing the user of frequency of occurence of searcged digit.All priting,reading should be done by system calls.
and we not allowed to use any liibrary functions.
signature of main function is...main(int argc,char**argv)

now,i can write the code for system calls...but my major programming problem is BRINGING IT ALL TOGETHER!

PLZZZZZZZZZZZZZZZ HELP ME...HOW DO I WRTIE THE CODE FOR THIS TASK?

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by Narue
0

>HOW DO I WRTIE THE CODE FOR THIS TASK?
I believe your caps lock key is stuck. Just like any non-trivial program, you break it up into manageable chunks. Instead of trying to do everything at once, start by writing the program without using separate processes. That's simple, so once you have it working you know that there's nothing wrong with it and can spawn a child process to do the work. Once you have that working, you can then use a pipes to communicate with the parent process and you're done!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.