[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

Reading pathnames from registry

I am reading a pathname from the registry and storing it in a char*.  For example "C:\Winnt\file.txt" is stored in a char*.  Now, when I want to open up this file, the "\"'s are escape sequences so the stream that I am trying to open doesn't exist (C:Winntfile.txt).  So my question is how do I add the escape sequence "\" in front of the "\"'s already in the char*?  Is there a way when reading from the registry to automatically add these extra slashes?  If not, how can I search for the single slashes in the string?
1 Solution
You are confused with the concept of escape sequences. You need to use escape sequences (double backslash \) only in your source code for the C++ compiler to recognize it. But it is stored as a single backslash \ internally.
TomMahieuAuthor Commented:
chensu... yeah i understood that...

but i have been programming too long today

a little tip - you need to build the path to the file before you try to open it...  ;)

time to go home...

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now