sml@trout.cis.ufl.edu (Shein-Fong Law) (11/02/90)
I am having troubles with using gets function. Here is the situation: void function() { char input[40]; while (.....) /* loop begins */ { .. some code printf(" enter value %s\n",value); gets(value); ..... } /* end of while */ } My problem is the first time I entered the while loop , both printf and gets statements are not executed.But after that everything is o.k. What I want is using a loop to prompt input from the user and get the value. For eaxmple, if there are 5 values to be entered (determined by while loop test ), I will prompt 5 times and at the same time get 5 values. Is there anything wrong ? I have put some more printf statements just before gets, and find that when I enter the loop for the first time, these print statements are excuted, but gets is still not executed. It seems that gets sees the EOL charater whenever I enter the loop for the first time. Any advice or help is greatly appreciated . Is there a better and more reliable way to do what I need ? Thanks in advance. If possible, please email to me. Shein-fong Law sml@beach.cis.ufl.edu