alright, I got output working fine:
read_out.cpp
#include <iostream>
int main()
{
for(int c=0;c<20;c++)
cout << "6";
return 0;
}
if i just run read_out on cmd line, i get this:
66666666666666666666
or I can pipe the input to a text file:
read_out > readout.txt
and get this:
66666666666666666666
what I want to do is read each string into another program, string by string. I would call it like this:
read_out > read_in
read_in.cpp
#include <iostream>
#include <string>
int main()
{
string word;
//while(getline(cin,word))
while(cin>>word)
cout << word << "\n";
}
it doesn't work, but do you see what i'm trying to accomplish? I'm trying to get the read_in program to read in words for as many words are supplied on the command line and process them word by word. What I don't know how to do is the 'while' loop which will retrieve the strings from the command line. I tried getline and cin, but neither worked the way I wanted.
Here is what I want the output to be:
read_out > read_in
read_out reads out 66666666666666666666, on 6 at a time
read_in reads in 66666666666666666666, one 6 at a time for as many 6s as read_out supplies. read_in will then process these words. In this example, it prints the strings to the screen with a newline after each string:
read_out > read_in
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
so does anybody know how to do the while loop to retrieve the strings?