Hi all,
i'm reading a file path from a serevr & going to read the contents in that file.
i created a ifstream object.but the problem is if the file path is c:\txt.txt,it doesn't read it as a file path.it reads \t as the tab.Is there any way to avoid this.In c# we can use @ sign.i thought of inserting one more dash manually.but it get complex if the file path contain many single dashes.
Highly appreciate all your great ideas.
Regards

Recommended Answers

All 2 Replies

The only way is to escape the backslash. C++ doesn't support verbatim strings like C#.

For your information, the escape character in C++ is the backslash. Hence, if you want a backslash, you need to add another backslash in front of it. (E.g. \\ will give you a backslash)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.