I'd like to convert a string's UNIX line endings to DOS ones, because my program communicates with a server running on a Linux-based operating system. I've tried using std::replace like that:
std::string str = readfromserver();
std::replace(str.begin(), str.end(), "\n", "\r\n");
but I got the following compiler error:
error C2782: 'void std::replace(_FwdIt,_FwdIt,const _Ty &,const _Ty &)' : template parameter '_Ty' is ambiguous
Could anyone tell me what am I doing wrong or suggest me a different way of line ending conversion?