Description | Center the contents of the source input string in the input size. |
Syntax | char *Center( char *pszSource, int nSize ); |
Arguments |
char *pszSourceThe source input string that needs to be centered into the given size.int nSizeThe size of where the contents of the souce input string needs to be centered. |
Returns | A pointer to the changed source input string. |
Remarks | The source input string is changed by this function.
WARNING:The input string should hold enough space for the size! |
Example |
#include <stdio.h> #include "lib.h" #include "input.h" //Holds the input functions #include "strfunc.h" //Holds the string manipulation functions void main( void ) { static char dummy[ 21 ]; for(;;) { strcpy( dummy, "hello!"); printf("\forg:|%s|,", dummy ); printf("new:|%-12.12s|\n", Center( dummy, 12 )); printf("\npress a key"); WaitForKey(); } } |