Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strdel(3pub) [debian man page]

STRDEL(3pub)						       C Programmer's Manual						      STRDEL(3pub)

NAME
strdel - delete characters from beginning of string SYNOPSIS
#include <publib.h> char *strdel(char *s, size_t n); DESCRIPTION
strdel removes the first n characters of s. If n is greater than the length of the string, all characters in the string (not counting '') are removed but no more. RETURN VALUE
strdel returns its first argument. EXAMPLE
To change all occurences of "Pascal" in the input to "Yuck!", you might do the following: #include <string.h> #include <stdio.h> #include <publib.h> int main(void) { char line[512]; while (fgets(line, sizeof(line), stdio) != NULL) { while ((p = strstr(line, "Pascal")) != NULL) { strdel(p, 6); strins(p, "Yuck!"); } printf("%s", line); } return 0; } SEE ALSO
publib(3), strins(3) AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi) Publib C Programmer's Manual STRDEL(3pub)

Check Out this Related Man Page

STRMAXCPY(3pub) 					       C Programmer's Manual						   STRMAXCPY(3pub)

NAME
strmaxcpy - copy at most a given number of characters of string SYNOPSIS
#include <publib.h> char *strmaxcpy(char *tgt, const char *src, size_t n); DESCRIPTION
strmaxcpy 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 VALUE
strmaxcpy returns its first argument. EXAMPLE
To 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 ALSO
publib(3), strncpy(3) AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi) Publib C Programmer's Manual STRMAXCPY(3pub)
Man Page