我正在做一個小型項目。我正在使用Valgrind工具檢查內存泄漏。當我使用這個工具時,我得到了下面的信息。 > 584 bytes in 74 blocks are definitely lost in loss record 103 of 104
> ==4628== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x
我想知道的是爲什麼將字符串轉換爲char *似乎使新char *不等於它來自的文字字符串。 如果我有: //raw versions of the string:
string s = "fun";
char* c = "fun";
char* s_convert = strdup(s.c_str()); //converting the string to char*
printf(
我在VS2013以下編譯錯誤: error C4996: '_strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
所以它要求我用同樣的話來代替「_strdup」。 我見過很多錯誤,要