GetLongPathName Undeclared

Posted by iwizardpro on Stack Overflow See other posts from Stack Overflow or by iwizardpro
Published on 2010-04-10T06:15:36Z Indexed on 2010/04/10 6:23 UTC
Read the original article Hit count: 188

Filed under:
|

When I try to compile my code with the function GetLongPathName(), the compiler tells me that the function is undeclared.

I have already read the MSDN documentation located @ http://msdn.microsoft.com/en-us/library/aa364980%28VS.85%29.aspx. But, even though I included those header files, I am still getting the undeclared function error. Which header file(s) am I supposed to include when using the function?

#include <Windows.h>
#include <WinBase.h>

#define DLLEXPORT extern "C" __declspec(dllexport)

DLLEXPORT char* file_get_long(char* path_original)
{
    long length = 0;
    TCHAR* buffer = NULL;
    if(!path_original)
    {
        return "-10";
    }
    length = GetLongPathName(path_original, NULL, 0);
    if(length == 0)
    {
        return "-10";
    }
    buffer = new TCHAR[length];
    length = GetLongPathName(path_original, buffer, length);
    if(length == 0)
    {
        return "-10";
    }
    return buffer;
}

And, if it makes a difference, I am currently compiling using Dev-C++ on a Windows Vista 64-bit.

© Stack Overflow or respective owner

Related posts about c++

Related posts about dev-c++