我有一个来自 fgets (line , 255 , pFile)
的 char* 行
,我想在其末尾添加字符“#”。我如何在 C++ 中执行此操作?
有点像
while ( fgets (line , 255 , pFile) != NULL )
{
line = line + '#'
}
最佳答案
strcat(line, "#");
当然,正确的答案是使用std::string
。
关于c++ - 在 char 指针的末尾追加一个字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19072499/