Reputation: 31263
What is the difference between: _fullpath and GetFullPathName
Of course I mean compare their ANSI/Unicode variants separatly
_fullpath
vs GetFullPathNameA
_wfullpath
vs GetFullPathNameW
It seems that _fullpath has much nicer and simpler API as it allows
to allocate the buffer for you but I just think if I replace GetFullPathNameW
with _wfullpath
what would I miss?
Upvotes: 5
Views: 2799
Reputation: 67251
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.
Upvotes: 3
Reputation: 21888
_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.
Upvotes: -2