Quote Originally Posted by MK27 View Post
Is it necessary to put the echo in the while loop or could you concatenate all the data there instead then and echo it all at once afterward?
In the bash script all the echo commands are stored into a file let's say its name is "aaa".Then for every line I read from that file in the script I have to pass it into the pipe in order my .cpp reads what the script sends.So in the script I have:


Code:
while read line;
do

	echo $line >> $2

done < 'aaa'
where line is every line of the file aaa and $2 is the name of the pipe the line has to be written to.

Then in my .cpp program I do:


Code:
while(child.getline(line,LINESIZE)){
		cout<<line<<endl;		
		sleep(1);
	}
where child is the ifstream the .cpp reads the pipe

Is there another way to write my data from the script to the pipe?
It's the most simple I can think of..