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.
ファイルから行を読み取っています。行は次のようになります。
89f81a03eb30a03c8708dde38cf:000391716
:問題は、 (を含む)の後のすべてを削除したいということです:。オンラインで見つけられるものはすべて試しましたが、使用const charしているようで、行はcharポインターです。
:
const char
char
使用できますstrchr:
strchr
char str[] = "89f81a03eb30a03c8708dde38cf:000391716"; char *ptr; ptr = strchr(str, ':'); if (ptr != NULL) { *ptr = '\0'; }