EC_STRVEC_NDUP(3)

πŸ’– EC_STRVEC_NDUP β€” the libecoli programmer's manual, but make it cute πŸ’–

okay bestie, sit down, hydrate, and let me tell you about ec_strvec_ndup from the libecoli programmer's manual ✨


✨ NAME ✨

ec_strvec_ndup β€” she duplicates a part of a string vector πŸ’… like not the whole thing, just a slice, and honestly? iconic behavior.


πŸŽ€ SYNOPSIS πŸŽ€

#include <ecoli/strvec.h>

struct ec_strvec * ec_strvec_ndup(
    const struct ec_strvec   *strvec,  /* The pointer to the string vector. */
    size_t                    off,     /* The index of the first string to duplicate. */
    size_t                    len      /* The number of strings to duplicate. */
);

so you're handing her three things, no cap:

  • strvec β€” the pointer to the string vector 🫢 the one you're copying from, don't lose her
  • off β€” the index of the first string to duplicate 🌸 where the copy starts, like a lil starting line
  • len β€” the number of strings to duplicate πŸ¦‹ how many of them you're taking with you

and she gives you back a struct ec_strvec * β€” a whole fresh baby strvec, born from that slice πŸ‘‘


🌈 DESCRIPTION 🌈

Attributes are duplicated if any. that's the whole vibe, fr fr β€” if your strvec is carrying attributes, they get duplicated too. she's not leaving anything behind, she's a main character like that πŸ’…


⭐ RETURN VALUE ⭐

you get back the duplicated strvec object πŸŽ€ a whole new one, all yours

or β€” and this is the part where we get a little dramatic 😭 β€” she returns NULL on error, and errno is set. so like, check that. always check that. don't be out here assuming bestie, okay?


πŸ’œ SEE ALSO πŸ’œ

the whole friend group, go say hi 🫢:


Copyright (C) 2010-2026 Olivier Matz, Robin Jarry. respect the elders, they built the whole libecoli house we're living in 🏠✨


and that's the page bestie!! πŸ¦‹ this was libecoli, dated 2026-06-11, and the page itself is EC_STRVEC_NDUP(3) β€” go forth, duplicate your slices, and remember: check errno, love yourself, periodt πŸ’…πŸ’–πŸŒΈ

πŸ“¦ where this page comes from