ofstream out("c:\\dirName\\test.txt",ios::out);the \ character within a string escapes the next letter. So you need to escape it itself, hence the \\.


twomers