[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Function            strtocomma - convert a string to xx,xxx format

  Syntax              char *strtocomma(char *source);

  Prototype in        stringhk.h

  Remarks             strtocomma converts a string of numbers into the
                      comma delimited format (xx,xxx,xxx). The number is
                      terminated by a non-digit (any character other than
                      0-9.) A leading sign will be copied before
                      converting the number.

                      The comma delimited string will be returned in
                      source, so you must make sure there is sufficient
                      space allocated.

  Return value        returns a pointer to source. This function writes
                      over the string passed to it.

  See also            strcomma()

  Example             #include <stringhk.h>
                      #include <stdio.h>            /* for the printf */

                      main()
                      {
                           char temp[15];

                           strcpy(temp,"12839.44");
                           printf("-> %s\n",strtocomma(temp));
                      }

  Program output      -> 12,839.44


See Also: strcomma()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson