rtapi_snprintf(3rtapi)

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

πŸ’– rtapi_snprintf β€” the RTAPI string-formatting girlies πŸ’–

okay so bestie, this is the rtapi_snprintf(3rtapi) page, from the RTAPI manual. two functions, one job: formatting strings, but make it realtime-safe. let's get into it 🫢


✨ NAME ✨

rtapi_snprintf, rtapi_vsnprintf β€” perform snprintf-like string formatting


✨ SYNTAX ✨

int rtapi_snprintf(char *buf, unsigned long int size, const char *fmt, ...)

int rtapi_vsnprintf(char *buf, unsigned long int size, const char *fmt, va_list apfB)

no cap, that's the whole vibe. ✨


✨ ARGUMENTS ✨

same as snprintf(3) or vsnprintf(3), bestie. literally identical energy, the usual suspects: the buffer, the size, the format, and whatever you're passing in.


✨ DESCRIPTION ✨

so these functions work just like the standard C printf family… except they only support a reduced set of formatting operations. it's giving "printf but she went on a diet". 😭

specifically:

  • formatting of long long values is not supported. nope. not happening. 🚫
  • formatting of floating-point values is done as though with %A, even when other formats like %f are specified. so if you asked for %f, bestie… you're getting %A energy anyway. πŸ’€

✨ REALTIME CONSIDERATIONS ✨

she can be called from non-realtime, init/cleanup, and realtime code. main character energy in every context, periodt. πŸ‘‘


✨ RETURN VALUE ✨

the number of characters written to buf. that's it, that's the number. ✨


✨ SEE ALSO ✨


okay that's the whole page, you ate that πŸŽ€

sign-off time: this lil page is from the LinuxCNC Documentation, dated 2006-10-12, and it lives at rtapi_snprintf(3rtapi). love her, she's iconic, iykyk πŸ’…πŸ’–πŸ¦‹