_fullpath vs GetFullPathName
What is the difference between: _fullpath and GetFullPathName
Of course I mean compare their ANSI/Unicode variants separatly
- Ansi:
_fullpath
vsGetFullPathNameA
- Uni:
_wfullpath
vsGetFullPathNameW
It seems that _fullpath has much nicer and simpler API as it allows
to al开发者_开发知识库locate the buffer for you but I just think if I replace GetFullPathNameW
with _wfullpath
what would I miss?
You wouldn't necessary miss anything. In fact, it's quite possible that _fullpath()
calls GetFullPathName()
. In that case, _fullpath()
works like a sort of wrapper for GetFullPathName()
, which would explain why the interface seems a little simpler and easier to use.
You simply have multiple ways to accomplish the same task. And, as long as either method is not obsolete and performs the task needed, the choice is entirely up to you.
_fullpath
is part of the C library.
GetFullPathName
is a Win32 API.
So basically, _fullpath
is cross platform and GetFullPathName
is Windows-specific.
In such cases, the C function usually relies on the underlying OS. So, in a Windows program, _fullpath
most likely boils down to GetFullPathName()
. But you don't have to care really.
精彩评论