#include <stdio.h>
#include <unistd.h>
static char* _intoaV4(unsigned int addr, char* buf, unsigned short bufLen)
{
char *cp, *retStr;
unsigned int byte;
int n;
cp = &buf[bufLen];
*--cp = '/0';
n = 4;
do
{
byte = addr & 0xff;
*--cp = byte % 10 + '0';
byte /= 10;
if (byte > 0)
{
*--cp = byte % 10 + '0';
byte /= 10;
if (byte > 0)
{
*--cp = byte + '0';
}
}
*--cp = '.';
addr >>= 8;
} while (--n > 0);
/* Convert the string to lowercase */
retStr = (char*)(cp+1);
printf("%s/n",retStr);
return(retStr);
}
int main()
{//_intoaV4(stbcapChannel.channelAddr,buf1,32),
char str[100]="";
char *ss;
ss=_intoaV4(142454,str,32);
printf("%s/n",ss);
getchar();
return 0;
}