ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/SubPipe.cpp
Revision: 1.2
Committed: Tue Mar 27 00:04:44 2001 UTC (23 years, 6 months ago) by ab11
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Changes since 1.1: +3 -1 lines
Log Message:
tidied up

File Contents

# User Rev Content
1 ab11 1.1 #include "SubPipe.h"
2    
3     SubPipe::SubPipe(string command){
4    
5 ab11 1.2 p = new iopipestream(command.c_str());
6 ab11 1.1 pid = (*p).pid();
7    
8     } // subPipe
9    
10    
11     int SubPipe::getLine(string * fillme){
12    
13     int bob = 2048;
14     char input[bob];
15    
16     if ( (*p).getline(input, bob-1) ){
17     string sinput = input;
18     *fillme = sinput;
19     return 0;
20     } else {
21     return 1;
22     } // if
23    
24     } // getLine
25    
26     SubPipe::~SubPipe(){
27    
28     // wait for process to finish first
29     waitpid(pid , 0, 0);
30 ab11 1.2 // remove all pointers to it, free up the memory so
31     // we can reclaim the file handles back
32 ab11 1.1 delete p;
33    
34     } // ~SubPipe
35