How to find out if std :: cin is reassigned?
Let's say I have a small program like:
int main()
{
cout << "Please enter the param >" << endl; // <-- Print only if input from console
std::string param;
cin >> param;
//Doing some calculations...
cout << "result is..."
}
I want to print the request for the parameter only if the input is from the console, but if the program was launched with redirection myApp.exe < textfile.txt, then I see no reason to print it.
How can I achieve this behavior?
Edit - I am working on windows.
+4