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. filesystem navigation in c++

filesystem navigation in c++

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++iosperformancelearning
7 Posts 3 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.
  • D Offline
    D Offline
    Desmo16
    wrote on last edited by
    #1

    Hi all, I've got the path to a file returned by a CFileDialog. (Let's call it "path") Now i wanna open another file in the same directory. I know the name of the file, of course. I tried with: file.open(path+"\..\newfile.txt",std::ios::in); but it tells me "not enough memory" at runtime. How can i do that ? Thanx in advance, Desmo16.

    M H 2 Replies Last reply
    0
    • D Desmo16

      Hi all, I've got the path to a file returned by a CFileDialog. (Let's call it "path") Now i wanna open another file in the same directory. I know the name of the file, of course. I tried with: file.open(path+"\..\newfile.txt",std::ios::in); but it tells me "not enough memory" at runtime. How can i do that ? Thanx in advance, Desmo16.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      How about... PathRemoveFileSpec(path); _tcscat(path, _T("\\newfile.txt")); file.open(path,std::ios::in); Mark

      D 1 Reply Last reply
      0
      • M Mark Salsbery

        How about... PathRemoveFileSpec(path); _tcscat(path, _T("\\newfile.txt")); file.open(path,std::ios::in); Mark

        D Offline
        D Offline
        Desmo16
        wrote on last edited by
        #3

        The compiler tells me PathRemoveFileSpec(path); identifier not found even with a research independent from the object is there anything i should include ? Thanx in advance, Desmo16.

        M 1 Reply Last reply
        0
        • D Desmo16

          The compiler tells me PathRemoveFileSpec(path); identifier not found even with a research independent from the object is there anything i should include ? Thanx in advance, Desmo16.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          #include Removes the file name and backslash from the end of a pathname string. Mark

          D 1 Reply Last reply
          0
          • M Mark Salsbery

            #include Removes the file name and backslash from the end of a pathname string. Mark

            D Offline
            D Offline
            Desmo16
            wrote on last edited by
            #5

            #include WHAT ?

            M 1 Reply Last reply
            0
            • D Desmo16

              #include WHAT ?

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              Sorry damn little angle brackets in html :doh: #include

              1 Reply Last reply
              0
              • D Desmo16

                Hi all, I've got the path to a file returned by a CFileDialog. (Let's call it "path") Now i wanna open another file in the same directory. I know the name of the file, of course. I tried with: file.open(path+"\..\newfile.txt",std::ios::in); but it tells me "not enough memory" at runtime. How can i do that ? Thanx in advance, Desmo16.

                H Offline
                H Offline
                Hamid Taebi
                wrote on last edited by
                #7

                In additional you can use of CFile instead file.open:)


                WhiteSky


                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