mconv_putc(3m17n)

πŸ“¦
version 1.8.4 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– mconv_putc β€” the m17n library's little "put one character out there" moment πŸ’–

okay bestie, so you're deep in the m17n manual (that's the man page section 3m17n, the library call corner of the docs) and you landed on mconv_putc. it's giving one character, one converter, one vibe. let's get into it 🫢


✨ SYNOPSIS ✨

int mconv_putc (MConverter * converter, int c)

that's it. two args. tiny function. main character energy, honestly. πŸ’…


🌸 DESCRIPTION 🌸

okay so, mconv_putc() writes a character via a code converter. fr fr, here's the whole deal:

  • the function writes the character c to the buffer area or the stream that is currently bound to the code converter converter β€” whichever one it's attached to right now, no cap
  • the encoder of converter is what actually encodes the character
  • the number of bytes that got actually written gets set into the nbytes member of converter (so go check that if you wanna know how much landed πŸ‘€)
  • and the internal status of converter gets updated appropriately β€” it's keeping track, it's an icon

so like, it's not just yeeting a char into the void, it's doing the whole bookkeeping thing. very responsible of it. πŸŽ€


πŸ”₯ RETURN VALUE πŸ”₯

  • if the operation was successful, mconv_putc() returns c β€” the character comes right back to you like a lil boomerang, slay ✨
  • if an error is detected, it returns EOF and assigns an error code to the external variable merror_code 😭
not the EOF jump scare. always check merror_code, bestie, it's the receipts.

πŸ’€ ERRORS πŸ’€

the error codes that can show up in merror_code are:

  • MERROR_CODING
  • MERROR_IO
  • MERROR_CHAR

three of them. all iconic. all capable of ruining your afternoon. 🌈


πŸ¦‹ SEE ALSO πŸ¦‹

go be nosy, the whole squad is here:

  • mconv_getc()
  • mconv_ungetc()
  • mconv_gets()

iykyk β€” putc, getc, ungetc, gets, the whole little friend group 🫢


Copyright (C) 2001 Information-technology Promotion Agency (IPA)

Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>.


okay that's the whole page, you're officially an mconv_putc() girlie now πŸ’…βœ¨ this was Version 1.8.4, dated Mon Sep 25 2023 β€” mwah, go write some characters, bye bestie! πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from