string str="abcdefgh...";
通过 str.c_str();可成功转化。 例如在 VS2005 以上版本中,对打开文件使用了 fopen_s(*pfile,path,"a+"); 当路径path存在 string中,那么就需要修改为: FILE *pFile; fopen_s(&pFile,path.c_str() , "a+"); fprintf(pFile, "%s/n", buf); fclose(pFile); |
如何将string转化为const char *
最新推荐文章于 2025-02-28 15:46:51 发布
