从10进制转化成8进制
char *get8String(long num){
int i = 0;
char *buffer = (char*)malloc(13);
char *temp;
buffer[0]='0';
buffer[12]='\0';
temp=buffer+1;
for(i=0;i<11;i++)
{
temp[i]=(char)(num<<3*i>>30);
temp[i]=temp[i]>=0?temp[i]:temp[i]+8;
temp[i]=temp[i]+48;
}
return buffer;
}
这上面从10进制转化成8进制怎么不行?