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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. To get filename from filepath..?

To get filename from filepath..?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 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.
  • M Offline
    M Offline
    Monisankar
    wrote on last edited by
    #1

    How to get file name from a given filepath without using winAPI for both windows and mac env?

    T R 2 Replies Last reply
    0
    • M Monisankar

      How to get file name from a given filepath without using winAPI for both windows and mac env?

      T Offline
      T Offline
      ThatsAlok
      wrote on last edited by
      #2

      is _tSplitPath work


      "I Think this Will Help"

      visit me at http://www.thisisalok.tk
      1 Reply Last reply
      0
      • M Monisankar

        How to get file name from a given filepath without using winAPI for both windows and mac env?

        R Offline
        R Offline
        rocky_pulley
        wrote on last edited by
        #3

        #include std::string strPath = "c:\\blah\\blahblah\\file.txt"; int pos = strPath.find_last_of("\\"); std::string strFile = strPath.substr(pos + 1); That should do it. -- Rocky Dean Pulley

        R 1 Reply Last reply
        0
        • R rocky_pulley

          #include std::string strPath = "c:\\blah\\blahblah\\file.txt"; int pos = strPath.find_last_of("\\"); std::string strFile = strPath.substr(pos + 1); That should do it. -- Rocky Dean Pulley

          R Offline
          R Offline
          rocky_pulley
          wrote on last edited by
          #4

          sorry, that first line is supposed to be: #include I forgot to remove the <'s as HTML tags. -- Rocky Dean Pulley

          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