MS_STRNCPCLEAN(3)

πŸ’– MS_STRNCPCLEAN(3) πŸ’–

okay so bestie, this is a page from the Library Functions Manual and we're talking about MS_STRNCPCLEAN(3) β€” literally the string-copying girlies that do things a little differently than the standard library. no cap. πŸŽ€


✨ NAME ✨

ms_strncpclean β€” non-standard string copying πŸ¦‹


🌸 SYNOPSIS 🌸

#include <libmseed.h>

int  ms_strncpclean ( char *dest, const char *source, int length );

int  ms_strncpopen ( char *dest, const char *source, int length );

πŸ’… DESCRIPTION πŸ’…

okay so let's get into it, because there are two of these and they are NOT the same girl. πŸ™ˆ

ms_strncpclean copies up to length characters from source to dest while removing all spaces. the result is left justified and always NULL terminated. so like, the destination string must have enough room for the non-space characters within length AND the NULL terminator β€” that's a maximum of length + 1. do the math bestie, length + 1. πŸ“βœ¨

ms_strncpopen copies length characters from source to dest, padding the right side with spaces if needed, and leaves the string open-ended (unterminated). so the result will always be length characters and will never be NULL terminated. it's giving "I don't do closures." πŸ’€

not me stressing about these being unterminated β€” that's literally intentional, that's the whole point, don't come for her. 😭

these routines are useful for converting to and from known length SEED string fields. iykyk. 🌈


πŸ‘‘ RETURN VALUES πŸ‘‘

  • ms_strncpclean returns the number of characters (not including the terminating NULL) in the destination string. πŸŽ€
  • ms_strncpopen returns the number of characters copied from the source string. πŸ¦‹

⭐ AUTHOR ⭐

Chad Trabant IRIS Data Management Center


and that's the whole vibe, bestie β€” page from the Libmseed API, dated 2004/11/22, filed under MS_STRNCPCLEAN(3). slay, go copy some strings, just don't forget your NULL terminator. periodt. πŸ’–βœ¨πŸŽ€πŸ«Ά