In the sample code below
std::string result = exec( "dir" ) ;
cout<<result;
I get the following error
error C2679: binary ‘<<‘ : no operator defined which takes a right-hand operand of type ‘class std::basic_string
I suspect there is a special method to print out an std::string.
Please help me debug this.
Also, I have included iostream.h, fstream.h and stream header files.
Answering my own question on behalf of @MrLister since he was inactive.
I should have included
<iostream>and<fstream>without.h. Alsousing namespace std;should have been typed after that.Ex:
Many many thanks to @MrLister.
And thanks to @dasblinkenlight. His answer enhanced a little bit.