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. GetShortPathName not working on x64 system

GetShortPathName not working on x64 system

Scheduled Pinned Locked Moved C / C++ / MFC
help
2 Posts 2 Posters 1 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.
  • R Offline
    R Offline
    Ranojay
    wrote on last edited by
    #1

    Hi All I am using the library function GetShortPathName to get the (windows)path name without spaces. Unfortunately this function is not working when I am compiling my output for x64 system The function is returning some garbage values. If it is a library function, I guess it uses C Run-Time Libraries (CRT), then why would it be different from 32 bit libraries. please note that my hard drive has NTFS and I can also see the short path name when I use the command dir /x . please help

    S 1 Reply Last reply
    0
    • R Ranojay

      Hi All I am using the library function GetShortPathName to get the (windows)path name without spaces. Unfortunately this function is not working when I am compiling my output for x64 system The function is returning some garbage values. If it is a library function, I guess it uses C Run-Time Libraries (CRT), then why would it be different from 32 bit libraries. please note that my hard drive has NTFS and I can also see the short path name when I use the command dir /x . please help

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      Ranojay wrote:

      If it is a library function, I guess it uses C Run-Time Libraries (CRT), then why would it be different from 32 bit libraries.

      Well, it doesn't use the CRT, actually - it's part of the OS and the CRT is layered on top of it. Have you thought of checking the return code? MSDN states this:

      If the function succeeds, the return value is the length, in TCHARs, of the string that is copied to lpszShortPath, not including the terminating null character. If the lpszShortPath buffer is too small to contain the path, the return value is the size of the buffer, in TCHARs, that is required to hold the path. Therefore, if the return value is greater than cchBuffer, call the function again with a buffer that is large enough to hold the path. If the function fails for any other reason, the return value is zero (0). To get extended error information, call GetLastError.

      Check the return value and (if it's zero), GetLastError, then repost.

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      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