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. ATL / WTL / STL
  4. How to get full path of sepcied file

How to get full path of sepcied file

Scheduled Pinned Locked Moved ATL / WTL / STL
tutorialquestion
2 Posts 2 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.
  • A Offline
    A Offline
    am 2009
    wrote on last edited by
    #1

    Hi, I want to get the full path of specified path. I use following function as DWORD dwRet = 0; TCHAR szPath[500]; LPTSTR lpszFilePart; dwRet = GetFullPathName(_T("MyFile.txt"), sizeof(szPath) / sizeof(TCHAR), szPath, &lpszFilePart); In above function i get path in szPath variable. but this path is always shows path in desktop, thought myfile.txt is placed in D: drive in othere folder.Also if file name not exists, though it show path with specied file name. How can I get full path of file by giving file name as input parameter. Thanks Abm

    J 1 Reply Last reply
    0
    • A am 2009

      Hi, I want to get the full path of specified path. I use following function as DWORD dwRet = 0; TCHAR szPath[500]; LPTSTR lpszFilePart; dwRet = GetFullPathName(_T("MyFile.txt"), sizeof(szPath) / sizeof(TCHAR), szPath, &lpszFilePart); In above function i get path in szPath variable. but this path is always shows path in desktop, thought myfile.txt is placed in D: drive in othere folder.Also if file name not exists, though it show path with specied file name. How can I get full path of file by giving file name as input parameter. Thanks Abm

      J Offline
      J Offline
      Jonathan Davies
      wrote on last edited by
      #2

      If you read the MSDN documentation, under Remarks is says: GetFullPathName merges the name of the current drive and directory with a specified file name to determine the full path and file name of a specified file...This function does not verify that the resulting path and file name are valid, or that they see an existing file on the associated volume. I think you will find that the current directory is set to the desktop which is why you are getting the result you are. If you want a full path to a different directory you will have to change the working directory.

      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