0

I am writing this to a .txt file.
The problem here is that it doesn´t compile when I write "\".
Why does this happening because this is just a string ?
I really need to get this "\" out to the file. Any idéas on this ?

ofstream out;
out.open("C:\\File.txt")

out << "Some Text" << "\" << '\n';
2
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by Jennifer84
0

Thank you for that, I was almost afraid it wasn´t possible. So it is the same as path searching in a way.

use two '\' characters similiar to how you did it in the open statement. out << "Some Text" << "\\" << '\n';

0

Yes, I will remember that now :)

In order to print the '\' character you have to use two of those little boogers.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.