CHR(3)

πŸ“¦ version 93vu, in opensuse-leap 16.0

πŸŽ€ NAME πŸŽ€

chr β€” character constant conversion routines. Also hii bestie, this is the CHR(3) page, and we're about to make character constants make sense, periodt. πŸ’…


✨ SYNOPSIS ✨

#include <ast.h>

int          chresc(const char* s, char** e);
int          chrtoi(const char* s);

🌸 DESCRIPTION 🌸

Okay so chresc converts and returns the next character constant in the 0-terminated string s. If e is not 0, then *e is set to point to the next character in s on return. When the end of s is reached, 0 is returned and e is not modified. 🫢

chrtoi converts the 0-terminated string s to an int and returns the value. The characters in s are converted in order from the left and shifted into the int value until up to the number of characters in an int is reached. This operation is inherently machine-dependent β€” highkey not universal β€” but at least it's defined in one place, which is a slay. ✨

The following \ escape sequences are recognized:

  • \ooo β€” the character represented by the octal code ooo.
  • \xxx β€” the character represented by the hex code xx.
  • \a β€” alert (bell).
  • \b β€” backspace.
  • \f β€” formfeed.
  • \n β€” newline.
  • \r β€” carriage return.
  • \t β€” horizontal tab.
  • \v β€” vertical tab.
  • \E β€” ESC (escape).
  • \\ β€” backslash.
🚨 important vibe check: other characters following \ are undefined (although for backwards compatibility they translate to themselves). So like… don't build your whole personality on that, bestie. 😭

πŸ¦‹ SEE ALSO πŸ¦‹

str(3) β€” go read it, iykyk. πŸ’–


✨ okay that's the page! CHR(3) from the Library Functions Manual, and there's no date on this footer β€” iconic minimal behavior, ngl. catch you in the next manpage πŸ’…πŸ«ΆπŸŒˆ

πŸ“¦ where this page comes from