Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ここでの私の質問に関連しています:次のコード
sprintf(buffer, "%-16s%-224s%-8s%-8s", "set", "ravi", "26", "60");
...空白を埋めます。'\0'スペースの代わりに文字を埋め込む必要があります。これは達成できますか?
'\0'
これは、次のループで実現できます。
int i; sprintf(buffer, "%-16s%-224s%-8s%-8s", "set", "ravi", "26", "60"); for (i=0;i<sizeof(buffer);i++) { if (buffer[i] == ' ') buffer[i] = '\0'; }