Use * character. sprintf(/* ... */, "%.*s", (int) strlen(str), str);. If you use C99, snprintf can also be suitable. man printf (3)
確定! 回上一頁