-
Somthing with string
Hi.
Is there a way to read something from the Win 32 Console screen that is already been printed something like this:
Code:
#include <iostream>
using namespace std;
int main()
{
char cstring[100];
cout<<"hi";
cin.getline( hopesit, 100 );
cin.get();
}
My idea is that he would read the "hi" printed in the screen and you don't need to hit enter, just that he uses "hi" as cstring. Is there a way to do that, thx.
-
Code:
#include <iostream>
using namespace std;
int main()
{
char cstring[100];
cout<<"hi";
cstring = "hi";
cin.get();
}
I guess I didn't understand... :confused:
-
sorry i dont know why i posted this
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string cstring ("hi");
cout << cstring << endl;
cin.get();
return 0;
}
-
You wanted to write to the input buffer so that it would be read by the getline? Crazy talk! (a.k.a. I am not aware of any such thing). However, the prospect of saying std::cin << "hi"; is pretty funny.
-
Sorry it's hard to explain, I'll get back to it tomorrow.