Today I saw again a question where the problem was OP didn't know he needs to escape the backslashes in a filename that was hard-coded in the source code. It usually boils down to this:
const char *fileName = "c:\unescaped\backslashes.txt";
Do I have green light to make such a post, akin to What is an undefined reference/unresolved external symbol error and how do I fix it?
Also any suggestions for its title/body? Right now I'm thinking this:
Title:
Why do I have to use double backslashes for file paths in code?
Body:
In languages like C, C++, Java, Python, and others, why do I need to use double backslashes when hard-coding a file path?
Also could it be made language-agnostic, as a lot of unrelated languages have this and it would be applicable to them.
It would be best if a moderator can make it a community wiki question, but if not, I or someone else can just ask and answer it.
r'c:\unescaped\backslashes.txt'