Skip to content

Glossary: C Basics

strcspn

Counts the characters before the first match of given characters. `buf[strcspn(buf, "\n")] = '\0';` removes the newline fgets leaves.

Where the book teaches it

Related terms

fgetsNewline