아래 코드 에서처럼 슬래시가 하나만있는 파일 경로를 이중 슬래시로 변환하려고합니다. 그러나 그것은 나에게std :: replace 오류가 발생했습니다
#include<algorithm>
std::string file_path;
using std::replace;
while(fgets(fname_buffer,1024,flist))
{
token = strtok(fname_buffer," ,\t");
file_size=atol(token);
token = strtok(NULL, " ,\t");
strncpy((char*)file_fp,token,32);
file_fp[32]='\0';
token = strtok(NULL, "\n");
file_path=token;
replace(file_path.begin(),file_path.end(),'\\',"\\\\");
//file_path.replace(file_path.begin(),file_path.end(),'\\','\\\\');
오류 C2664 마지막에 표시되는 오류가 있습니다 : '표준 : < _Elem, _Traits을 basic_string, _Ax이 &에게 표준 : < _Elem, _Traits, _Ax을 basic_string> :: 교체>를 (부호없는 INT, 부호없는 INT는 const를 _Elem * 서명되지 않은 INT는) : 당신은 대체하려는
사용 [이] (HTTP : // WWW를. boost.org/doc/libs/1_49_0/doc/html/boost/algorithm/replace_all.html). search-replace-repeat 알고리즘보다 훨씬 낫습니다. –