Hello All
I want to accept the string from user till he press "enter" key.
For that I used gets() function on Windows.
But the same program not run on Linux.
Can any one tell me alternative for this function?
yashsaxena -1 Light Poster
Recommended Answers
Jump to Postgets() is broken by design and you should use fgets() instead, but unless "program not run" means you're scared of a compiler warning to that effect, fgets() will likely suffer the same issue because the problem is in your code or your assumptions about the environment. You should learn to …
Jump to PostAlso why don't they just remove gets() function from compilers if it's so problematic?
Backward compatibility. Removing features has a tendency to break a lot of programs that use the feature, and gets() is unfortunately very common. The good news is that gets() has finally been voted off the island …
All 8 Replies
Narue 5,707 Bad Cop Team Colleague
can_surmeli 1 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
can_surmeli 1 Newbie Poster
can_surmeli 1 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Narue 5,707 Bad Cop Team Colleague
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.