I wrote a GUI program that can also be opened with arguments in a console. When I ask for user input (a password) the program ask it twice. The first input is send to the console (obviously unrecognized) and the second is sent to my program.
if(!AttachConsole(ATTACH_PARENT_PROCESS)) exit(EXIT_FAILURE); freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stderr); freopen("CONIN$", "r", stdin); char var[10]; printf("before gets\n"); fgets(var,10,stdin); printf("after gets\n"); printf("var : %s\n",var);
Is there a way to use the console then give it back to cmd.exe?
https://stackoverflow.com/questions/65416612/program-ask-input-twice-and-send-it-to-console-allocconsole December 23, 2020 at 06:28AM
没有评论:
发表评论