please dont rip this site

Language Ccpp Cref Examples SPRINTF1.C

/ ***********************************************************************
 *
 * Purpose: Program to demonstrate the * flag limiting a string filed width
 *          in a 'sprintf' statement.
 *
 *          This example shows an alternative way of performing a strncpy.
 *
 * Author:  M J Leslie
 * Date:    18-Mar-98
 *
 ************************************************************************/

#include <stdio.h>

main()
{
    char Dest[10] = "";
    char Src[]    = "Ski on Whistler Mountain";
                                                  /* Populate Dest */
    memset  (Dest, 0, sizeof(Dest));
    sprintf (Dest, "%.*s", sizeof(Dest)-1, Src);
                                                  /* Show the results. */
    printf("Src string : %s\n", Src);
    printf("Dest string: %s\n", Dest);
}


file: /Techref/language/ccpp/CREF/EXAMPLES/sprintf1.c, 0KB, , updated: 1998/3/18 09:44, local time: 2024/11/26 23:39,
TOP NEW HELP FIND: 
3.147.62.5:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/Techref/language/ccpp/CREF/EXAMPLES/sprintf1.c"> language ccpp CREF EXAMPLES sprintf1</A>

Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .