これを使用しようとしていますが、valgrind で実行すると、メモリの問題が発生します。
たとえば
char *serialize_file(t_file_package *pack) {
char *payLoad = malloc(numDigits(pack->file_desc)+numDigits(pack->priority)+strlen(pack->code)+2);
sprintf(payLoad, "%d#%d#%s", (uint32_t)pack->file_desc,(int16_t)pack->priority, pack->code);
char *pack = malloc(numDigits(PROCESS) + numDigits((int64_t)strlen(payLoad)) + strlen(payLoad)+2);
sprintf(pack, "%d#%d#%s",PROCESS, strlen(payLoad), payLoad);
free(payLoad);
return pack;
}
私はasprintfの存在を知っていますが、GNU ANSI Cプロジェクトでそれを使用できない理由を知りません...私のEclipseは、その関数が認識されていないと言っています
よろしくお願いします!