此文总结于《你必须知道的495个C语言问题》12.12小节;
#include <locale.h>
/**
*输出千位上面用逗号隔开的数字
*
**/
char *commaprint(unsigned long n)
{
static int comma = '\0';
static char rebuf[30];
char *p = &rebuf[sizeof(rebuf)-1];
int i = 0;
if(comma == '\0')
{
struct lconv *lcp = localeconv();
if(lcp != NULL)
{
if(lcp->thousands_sep != NULL && *lcp->thousands_sep != '\0