The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk read input files tgooper Shell Programming and Scripting 10 4 Weeks Ago 08:58 AM
Read from file > process > output to file Lorna Shell Programming and Scripting 3 10-06-2008 01:45 AM
getline to read input from a user sdsd UNIX for Dummies Questions & Answers 6 09-24-2008 10:30 PM
read input file tjmannonline UNIX for Dummies Questions & Answers 2 08-05-2008 11:24 AM
ls while read loop - internal read picking up wrong input dkieran Shell Programming and Scripting 2 05-14-2007 03:02 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-04-2009
cupid1575 cupid1575 is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 3
read input-process-output

Can you help me ?
I want to write a program ,which can open a input file (input.txt) and run as child process ,then write to output file (output.txt).......
c Code:
  1. char inFile[1024]="input.txt";
  2. char outFile[1024]="output.txt";
  3. int main(int argc, char **argv)
  4. {
  5.   pid_t pid=1;
  6.   int no=0;           // no. of command
  7.   char command[1024]; // contain each line of input file
  8.   ...........
  9.  while (pid && fgets(command,1023,iFile)!=NULL)
  10. {
  11.         if (pid==0){
  12.    
  13.       //TODO: Child process
  14.       //      Run command and write output to file
  15.       //      Child process should sleep 1 second to wait parent prcess
  16.       //        to finish writing to output file
  17.  
  18.     else if (pid>0)
  19.   {
  20.  
  21.       //TODO: Parent process
  22.       //      Write the no. of command to file
  23.       //      Wait child process to finish
  24.  
  25.     }
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0