copy the string one character at a time into another variable that is long enough to hold the extra characters. When an '\' is encountered just copy two of them.
But I have to question your reason for doing that. When you type a path from the keyboard into a variable you don't need the couble '\' characters. They are only needed when you use string literals in your program because the compiler has to interpret the characters.