cmd - Command Line Program - Sending 'Enter' commands -
I have a command line program that has a menu with many options and I want to define the parameter program.exe & lt; Input.txt
but I'm having trouble sending 'enter' commands (if I try to send anything then the program crashes, such as '' character).
I enter 'All' in the form of a pro name. After that enter the name 'again' and I have to enter the code to continue. Can not I work outside is how to enter this program. I have tried a black line in input.txt, but that does not work.
while (! End) {for (legal = 0 ;; legal;) {Printf ("\ tEnter proc name:"); If (fgets (str, 70, stdin) == faucet) {printf ("by. \ N"); Exit (0); } Ret = sscanf (str, "% s", p.name); If (rate> 0? Str [0] == '\ n') legal = 1; Else printf ("Please enter a legal name, any or all \ n"); } If (str [0] == '\ n') {end = 1; } And if (! Strcmp (p.name, "all")) {for (i = 0; i & lt; Conf_num_procs (& amp; cn;); i ++) position_ vector [i] = 1; } And if (! Strcmp (p.name, "none")) {for (i = 0; i & lt; Conf_num_procs (& amp; cn;); i ++) position_ vector [i] = 0; } Other {proc_index = Conf_proc_by_name (p.name, & amp; p); If (proc_index! = -1) {status_vector [proc_index] = 1; } And printf ("Please enter a legal Prospease name, none, or all \ n"); }}
Comments
Post a Comment