Bonjour j'ai une string contenant un chemin d'accès tu style "c:\toto\titi.txt"et j'aimerais doublé le \ et avoir une chaine du style "c:\\toto\\titi.txt".

Comment faire ???

j'ai tout d'abort essayer avec le code de la faq c++ que j'ai modifié pour mon besoin : http://c.developpez.com/faq/cpp/?pag...#STRING_tokens
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
		string val;
		string mot;
		val = "";
 
		string spath;
		spath = path.substr(0,path.find('\n'));
		istringstream iss( spath );
		while ( getline ( iss, mot, '\' ) )
		{
			if(val == "")
			{
				val = mot;
			}
			else
			{
				val = val + "\\" + mot;
			}
		}
mais j'ai une erreur :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
c:\dev\anamorphose\anamorphosedlg.cpp(333) : error C2001: newline in constant
c:\dev\anamorphose\anamorphosedlg.cpp(333) : error C2015: too many characters in constant
une idée ???