fgets is unsafe! So what’s the alternative?

Описание к видео fgets is unsafe! So what’s the alternative?

fgets is often described as a “safe” C function – one you should use instead of gets or scanf.

But is it really safe?

The plain answer is: NO. You can very easily corrupt data by reading unintended characters from the command prompt using fgets, as I explain in this video.

In previous videos I’ve already shown that standard C line-reading functions are unsafe so if fgets is unsafe too, what should you use instead?

In this lesson, I explain the problems and suggest some solutions.

To follow the course in order, bookmark the playlist:
   • Program C in Visual Studio  

PROGRAMMING BOOKS
====================
If you want to learn C in more depth (and also support this channel!) you might think of buying one of my books. I have written books on C programming, Using Pointers in C, Recursion and other programming topics.

** The Little Book Of C Programming **
Amazon (US) https://amzn.to/2RXwA6a
Amazon (UK) https://amzn.to/2JhlwOA

GET THE SOURCE CODE
=================================
Download the source code of the projects in this course (the archive for “The Little Book Of C”) from:
http://www.bitwisebooks.com/

“CODE WITH HUW” ON TWITTER:
=================================
  / codewithhuw  

“CODE WITH HUW” ON FACEBOOK:
=================================
  / codewithhuw  

Good luck! And good programming!

Комментарии

Информация по комментариям в разработке