Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. string append with \ symbol

string append with \ symbol

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thilek
    wrote on last edited by
    #1

    hi guys, i am developing a worm scanner.. i have to choose the directories from Folder Browser Dialog.. when i does that i will get the directory C:\NVIDIA\Win2KXP but i need to convert it to C:\\NVIDIA\\Win2KXP so that i can get the file names in the that directory using ListFiles...... since the symbol \ i could not put \ between "" and '' how can i solve this ya?? help me plz...

    E K 2 Replies Last reply
    0
    • T Thilek

      hi guys, i am developing a worm scanner.. i have to choose the directories from Folder Browser Dialog.. when i does that i will get the directory C:\NVIDIA\Win2KXP but i need to convert it to C:\\NVIDIA\\Win2KXP so that i can get the file names in the that directory using ListFiles...... since the symbol \ i could not put \ between "" and '' how can i solve this ya?? help me plz...

      E Offline
      E Offline
      Eytukan
      wrote on last edited by
      #2

      Thilek wrote:

      but i need to convert it to C:\\NVIDIA\\Win2KXP so that i can get the file names in the that directory using ListFiles......

      You don't need to convert it. You can use them straight. Only when you hard-code, you'll have to do this. Your question is slightly blurred to me though.

      He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

      T 1 Reply Last reply
      0
      • E Eytukan

        Thilek wrote:

        but i need to convert it to C:\\NVIDIA\\Win2KXP so that i can get the file names in the that directory using ListFiles......

        You don't need to convert it. You can use them straight. Only when you hard-code, you'll have to do this. Your question is slightly blurred to me though.

        He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

        T Offline
        T Offline
        Thilek
        wrote on last edited by
        #3

        when i use C:\Private_Folder\forGetz its not seaching or getting the file name.. unless i use C:\\Private_Folder\\forGetz or C://Private_Folder//forGetz then its working :( but when i use folder browser dialog , i will be getting as C:\Private_Folder\forGetz....

        M D 2 Replies Last reply
        0
        • T Thilek

          when i use C:\Private_Folder\forGetz its not seaching or getting the file name.. unless i use C:\\Private_Folder\\forGetz or C://Private_Folder//forGetz then its working :( but when i use folder browser dialog , i will be getting as C:\Private_Folder\forGetz....

          M Offline
          M Offline
          Maxwell Chen
          wrote on last edited by
          #4

          Are you using std::string to hold the value?

          Maxwell Chen

          T 1 Reply Last reply
          0
          • M Maxwell Chen

            Are you using std::string to hold the value?

            Maxwell Chen

            T Offline
            T Offline
            Thilek
            wrote on last edited by
            #5

            yes....

            1 Reply Last reply
            0
            • T Thilek

              hi guys, i am developing a worm scanner.. i have to choose the directories from Folder Browser Dialog.. when i does that i will get the directory C:\NVIDIA\Win2KXP but i need to convert it to C:\\NVIDIA\\Win2KXP so that i can get the file names in the that directory using ListFiles...... since the symbol \ i could not put \ between "" and '' how can i solve this ya?? help me plz...

              K Offline
              K Offline
              KarstenK
              wrote on last edited by
              #6

              You must understand the difference between the hardcoded "\\" and thr "\" in the value of the variable. :doh: "\\": is an so calles 'escape sequence' FOR representing the "\" in the string. Look in the values of strings int the debugger :-O

              Press F1 for help or google it. Greetings from Germany

              T 2 Replies Last reply
              0
              • K KarstenK

                You must understand the difference between the hardcoded "\\" and thr "\" in the value of the variable. :doh: "\\": is an so calles 'escape sequence' FOR representing the "\" in the string. Look in the values of strings int the debugger :-O

                Press F1 for help or google it. Greetings from Germany

                T Offline
                T Offline
                Thilek
                wrote on last edited by
                #7

                thanks ya...

                1 Reply Last reply
                0
                • T Thilek

                  when i use C:\Private_Folder\forGetz its not seaching or getting the file name.. unless i use C:\\Private_Folder\\forGetz or C://Private_Folder//forGetz then its working :( but when i use folder browser dialog , i will be getting as C:\Private_Folder\forGetz....

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  Thilek wrote:

                  when i use C:\Private_Folder\forGetz its not seaching or getting the file name.. unless i use C:\\Private_Folder\\forGetz or C://Private_Folder//forGetz then its working

                  Because those are string literals, which must contain double backslahes.

                  Thilek wrote:

                  but when i use folder browser dialog , i will be getting as C:\Private_Folder\forGetz....

                  Which is correct.

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  1 Reply Last reply
                  0
                  • K KarstenK

                    You must understand the difference between the hardcoded "\\" and thr "\" in the value of the variable. :doh: "\\": is an so calles 'escape sequence' FOR representing the "\" in the string. Look in the values of strings int the debugger :-O

                    Press F1 for help or google it. Greetings from Germany

                    T Offline
                    T Offline
                    Thilek
                    wrote on last edited by
                    #9

                    :laugh: its so funny that i been breaking my head for days with this... thanks a lot.. u saved me...

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups