c++ - how to Display error message in console mode in VC++? -


i working on vc++ windows application support gui non-gui based execution. non gui based execution designed console mode purpose. now, if executed application in gui mode can show message box user acknowledgement in case of error or exception.

but in console mode, have execute

c:> myapp.exe -options -ms yes

if user type above command without "-options"keyword. want display error message in console mode.

the idea check options key entered , exit if not. approximate code of solution:

int main(int argc, char** argv) {     if (...) // check options presence here     {         cerr << "myapp should run myapp.exe -options -ms yes" << endl;         return 0;     }     ... // actual work here } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -