K
Key9
Hi all
This is an simple app : read cin and print to cout
I want it's action like "cat" with out arguement.
#include <iostream>
#include <string>
using namespace std;
int main(int argc, int *argv[])
{
string str;
while( cin >> str ){
cout << str << endl;
}
}
$./test
This is key hit by keyboard input <return>
This
is
key
hit
by
keyboard
input
but if I change cout << str << endl; to cout << str;
$ ./test
This is key hit by keyboard input
Thisiskeyhitbykeyboardinput
how to solve this problem?
Thanks
key9
This is an simple app : read cin and print to cout
I want it's action like "cat" with out arguement.
#include <iostream>
#include <string>
using namespace std;
int main(int argc, int *argv[])
{
string str;
while( cin >> str ){
cout << str << endl;
}
}
$./test
This is key hit by keyboard input <return>
This
is
key
hit
by
keyboard
input
but if I change cout << str << endl; to cout << str;
$ ./test
This is key hit by keyboard input
Thisiskeyhitbykeyboardinput
how to solve this problem?
Thanks
key9