sprintf()                Write Formatted Data to String
 
 #include   <stdio.h>
 
 int        sprintf(buffer,format-string[,argument...]);
 char       *buffer;                     Storage location for output
 char       *format-string;              Format-control string
 
    sprintf() formats and stores a series of characters and values in
    'buffer'.  sprintf() operates identically to printf(), with the
    exception that sprintf() "prints" to a buffer, while printf() prints
    to stdout.  With that single exception, the two functions are
    identical; see the printf() function for a complete description of
    the format-string and arguments.
 
  -------------------------------- Example ---------------------------------
 
    The following statements format and store data in 'buffer'.
 
         #include <stdio.h>
 
         char buffer[100];
         char *name = "Ali Rae";
         char age = '1';
         char s = 'F';
 
         main()
         {
             sprintf(buffer,"%s, %c, %c",name,age,s);
             printf("Birthdays this month: %s\n",buffer);
         }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster