Sample code for 30+ languages & platforms
Unicode C

Get the Target of a Symbolic Link

See more FileAccess Examples

Demonstrates how to get the target of a symbolic link.

Note: This example requires Chilkat v9.5.0.77 or greater.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkFileAccessW.h>

void ChilkatSample(void)
    {
    HCkFileAccessW fac;
    const wchar_t *targetPath;

    fac = CkFileAccessW_Create();

    targetPath = CkFileAccessW_symlinkTarget(fac,L"qa_data/my_symlink");
    if (CkFileAccessW_getLastMethodSuccess(fac) != TRUE) {
        wprintf(L"Failed to get symlink target.\n");
        CkFileAccessW_Dispose(fac);
        return;
    }

    wprintf(L"target path = %s\n",targetPath);


    CkFileAccessW_Dispose(fac);

    }