scan_hexdump(3)

πŸ’… NAME πŸ’…

okay bestie, say hi to scan_hexdump β€” she decodes hexdump data. that's it, that's the job, and she does it flawlessly. no cap. ✨


🌸 SYNTAX 🌸

like, the way you summon her:

#include <libowfat/textcode.h>

size_t scan_hexdump(const char *src,char *dest,size_t* destlen);

look at that signature. gorgeous. iconic. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so scan_hexdump takes hexdump data from src and decodes it into dest. simple. slay. 🫢

the moment she bumps into any invalid input characters she just stops. no drama, no guessing β€” she's done. and then:

  • she writes the number of decoded bytes that landed in dest into *destlen
  • and she returns the number of bytes she decoded from src
ngl, here's the tea: in the real world, hexdump data is sometimes allowed to contain whitespace characters or new lines. this function will not allow those, and will just return the decoded data up until that point. so don't come for her, she's strict on purpose. 😭

and the flexible queen she is:

  • dest can be NULL
  • destlen can be NULL
  • dest can be src β€” in-place, we love a multitasker πŸ’…

πŸ‘‘ RETURN VALUE πŸ‘‘

scan_hexdump returns the number of bytes successfully scanned and processed from src. that's the number. that's the whole vibe check. ⭐


🌈 EXAMPLES 🌈

here's her in action, serving exactly what you'd expect:

scan_hexdump("302e",buf,&i) -> return 4, i=2, buf="0."

return 4, i=2, and buf="0.". ate and left no crumbs. πŸ”₯


πŸ“ SEE ALSO πŸ“

go give her friends some love too:


and that's the whole page, bestie πŸ’– this was scan_hexdump(3) from the Library Functions Manual β€” go decode something cute, mwah 🧚