close

C 的標準函式庫提供了兩個非常好用的函式,可以快速的轉換字串成為數值。


char s[10];
int n;
int count = sscanf(s, "%d", &n); // 字串s轉數字n
int length = sprintf(s, "%d", n); // 數字n轉字串s


http://blog.urdada.net/2008/04/18/85/

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 prague12 的頭像
    prague12

    prague12

    prague12 發表在 痞客邦 留言(0) 人氣()