摘要:        
int snprintf(char *restrict buf, size_t n, const char * restrictformat, ...);函数说明:最多从源串中拷贝n-1个字符到目标串中,然后再在后面加一个0。所以如果目标串的大小为n 的话,将不会溢出。函数返回值:若成功则返回欲写入的字符串长度,若出错则返回负值。Result1(推荐的用法)#include #include int main(){ char str[10]={0,}; snprintf(str, sizeof(str), "0123456789012345678"); printf(&qu    阅读全文
        
            posted @ 2013-07-04 14:24
小葫芦藤
阅读(1906)
评论(0)
推荐(0)
        
    
                    
                
浙公网安备 33010602011771号