strmaxcpy man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

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

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 '\0'.  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 '\0'.  It also doesn't fill the result with extra '\0' characters.

RETURN VALUE
       strmaxcpy returns its first argument.

EXAMPLE
       To print out the first 69 characters of a string, you might do the fol‐
       lowing  (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 + '\0' */

		 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(3)
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net