Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
the 'gets()' function is not working inside a 'do ...while' loop after one cycle of execution
Posted
Updated 11-Jun-18 2:30am
Comments
Kenneth Haugland 7-Apr-13 16:33pm    
We need to see the code in order to help you out here.
[no name] 7-Apr-13 16:49pm    
The use of the debugger can help you out a great deal in this situation.

First of all, don't use gets(), use getline() instead. See http://www.crasseux.com/books/ctutorial/gets.html[^].

See an example of getline() at http://www.crasseux.com/books/ctutorial/getline.html#getline[^].

Cheers
Andi
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Apr-13 22:52pm    
Sure, a 5.
—SA
Andreas Gieriet 8-Apr-13 2:58am    
Thanks for your 5!
Cheers
Andi
add getchar(); just before the loop ends.


instead of using gets() use fgets() as gets() may results in buffer space over run.
 
Share this answer
 
v2
Comments
Richard MacCutchan 25-Jun-15 6:09am    
This question is more than two years old! Please do not add posts to dead items.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900