+ 4
Alternative for gets() in C?
Hi, it is a big problem here in sololearn to use gets() function for collecting string input. It generates a disgusting warning in the output. So, I am searching for an alternative. I know I can use scanf("%s",str); but unlikely gets(), it stops getting input when the user enters a whitespace. So, can you please provide me with an alternative for gets()?
3 Answers
+ 3
fgets() and getline() are some alternatives
https://blogcwi.wordpress.com/2015/04/27/gets-docx/
0
fgets(), u can also try regex with scanf(), or write ur own function.
- 2
stdio.h