All languages

C

You're viewing a free preview. Sign in free to read every script.

Why this exists Almost every tool you write reads text it did not create: a port number from the command line, a line of a config file, a field in a log. That text can be empty, too long, half a number, or plain wrong.…

C Basics: Parsing Text Safely with strtol, Trimming, Splitting and a key=value Config

Turn text into numbers and settings without trusting it: why atoi is unsafe, how strtol reports errors, trimming and splitting in place, and a small config-file reader that tells the user which line is wrong.

Sign in free to read this script, along with the rest of the library.

Sign in free