I need a way to detect what the windows system console is outputting to the user (i.e. if i typed something in cmd with incorrect syntax it would tell me so, i need the app to be able to read this)
This is probably a bit more advanced for what should be in this part of the forum but i'm sure there has to be a simple answer like a function that returns a string for the last post to the console window?
Hey, i am probably reading this wrong, but i am shady on the issue.
Do you want to check what the user writes and inputs? like checking: cin. Or you want to check what you, yourself, are outputting(with cout) to the console?
Neither, i want to check what the DOS area of the console outputs to the user.. For example....
If in my program somewhere there is the statement system("pause"); then the program send the DOS pause command to the console and the console send the message
Press any key to continue . . .
I'm looking for a way that my program will be able to read the DOS output, so if there's a simple function for this it would return a string or such containing "Press any key to continue . . ."
Hopefully this clarifies anything you was unsure about?
Well it's one certain way of finding out if any system() calls where succeful no matter what was contained within the function argument.
To be honest this was a pretty dumb question to ask but if this is possible it could be interesting to use for problem solving for certain things...
If you cant answer this i suppose it would be much easier to answer what that function returns on the success or failure of system("runas /user:Administrator cmd");
What does this function call return for... incorrect syntax, incorrect user, unknown command, success in command but failure in password, full success?
IINM, system() returns the return code of the program. Generally, 0 means success and non-zero means error. The program's documentation should detail the various error codes.
At this point I should say that this kind of code belongs in a console script, not a C++ program.
Ok cheers.
And i know the first question i asked was rather dodgy but i thought that if i could read the console output then i could use it for any function i send to system() without having to look it up seperately.