Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>strncpy</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
strncpy

Usage

   #include <string.h>
   char *strncpy(char *string1,const char *string2, size_t n):

   ANSI

Description

   Copies the first n characters of string2 into string1. If string2 is
   longer than string1, the result will not be null  \0' terminated. If
   string2 is less than n characters, string1 will be padded to n with null
   characters.

Example

   #include <stdio.h>
   #include <string.h>
   #include <stdlib.h>

   char *string2 = " Add this string";
   char buffer[50];

   int main()
   {
       printf("\nstrncpy Example[%s]\n",

               strncpy(buffer,string2,10));
       return EXIT_SUCCESS;
   }

Return Value

   It returns string1. strnset

Usage

   #include <string.h>
   char *strnset(char *string,int ch,size_t n);

Description

   Sets at most n characters of string to ch.

Example 

   #include <stdio.h>

   #include <string.h>
   #include <stdlib.h>

   char *string2 = "Example string";

   int main()
   {
       printf("\nstrnset Example   [%s]\n",
               strnset(string2,'x',9));
       return EXIT_SUCCESS;
   }

Return Value

   It returns string.





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson