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!

Everything You Thought You Knew About Arrays is Wrong (in C Programming). This is Why.

scanf – Why you should NEVER use it (Program C In Visual Studio Course)

Introduction to Linux 101 - What is a Shell?

Stupid C Tricks: Unsafe Functions You MUST Avoid!

the true reason C++ always wins

Psychology of People Who Code in Assembly (Refusing the Safety Nets)

is it possible to write SAFE C? (with BILLIONS of deployments)

C Strings are Terrible!

Why Do Best-Selling Writers Use a 40 year-old Word Processor?

Every Programmer Should Know These 3 Languages (No, NOT Python!)

This C code should be ILLEGAL. It's also fantastic.

The ONE Thing Most C Programmers Get Wrong!

Master Pointer Arithmetic In 10 Minutes (The Ultimate Guide For C Programmers).

Tips for C Programming

ASMR | DEEP IMMERSION 🌊 Sleep & Tingles Like Never Before (4K - No Talking)

Can we create a destructor or automatically clean up variables in C?

Reinventing Entropy | Compression is Intelligence Part 1

A New Era for C and C++? Goodbye, Rust?

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup

