Jump to content
  • Advertisement
Sign in to follow this  
nuclear123

GetFullPathName() return value question

This topic is 2442 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

msdn says the following about the return value of GetFullPathName()

[color=#2A2A2A]
[color=#2A2A2A]If the lpBuffer[color=#2A2A2A] buffer is too small to contain the path, the return value is the size, in TCHARs[color=#2A2A2A], of the buffer that is required to hold the path and the terminating null character.[/quote][color=#2A2A2A]

are they saying that if it fails because i needed a 200 size buffer of wchar_t's instead of a 199 size buffer it will return the value of 200*2 as my return value in lpbuffer or will it return just 200?

Share this post


Link to post
Share on other sites
Advertisement
It essentially returns the length of the string it attempted to copy into the buffer whether it succeed or failed. So the latter was correct, if the buffer size required was 200, then it will return 200. I'm not actually sure how you got the idea that it would be 2*200, care to explain your reasoning?

Share this post


Link to post
Share on other sites
It returns the number of characters long your buffer needs to be, not the required number of bytes.
A return of 200 would indicate that you need 200 wchar_t’s.

Additionally, unless you are specifically calling GetFullPathNameW(), always work with type TCHAR. Never work with char or wchar_t unless you are manually calling GetFullPathNameA() or GetFullPathNameW().


L. Spiro

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!