Query: strmaxcpy
OS: debian
Section: 3pub
Links: debian man pages all man pages
Forums: unix linux community forum categories
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
STRMAXCPY(3pub) C Programmer's Manual STRMAXCPY(3pub)NAMEstrmaxcpy - copy at most a given number of characters of stringSYNOPSIS#include <publib.h> char *strmaxcpy(char *tgt, const char *src, size_t n);DESCRIPTIONstrmaxcpy copies up to n-1 characters from the beginning of src to tgt, then adds a ' '. n must be at least 1. The target string must be large enough to hold the result. Note that unlike strncpy(3), this function always terminates the result with ' '. It also doesn't fill the result with extra ' ' charac- ters.RETURN VALUEstrmaxcpy returns its first argument.EXAMPLETo print out the first 69 characters of a string, you might do the following (although familiarity with printf's format string might be more useful in this case). #include <stdio.h> #include <publib.h> void print42(const char *string) { char copy[43]; /* 42 + ' ' */ puts(strmaxcpy(copy, string, sizeof(copy))); }SEE ALSOpublib(3), strncpy(3)AUTHORLars Wirzenius (lars.wirzenius@helsinki.fi) Publib C Programmer's Manual STRMAXCPY(3pub)
Related Man Pages |
---|
strltrim(3pub) - debian |
strmaxcpy(3pub) - debian |
xmalloc(3pub) - debian |
xfree(3pub) - sunos |
xmalloc(3pub) - sunos |
Similar Topics in the Unix Linux Community |
---|
Copying characters on each line in a file |