#include#include int main() { QFileInfo symLinkInfo("/path/to/symlink"); qDebug() << "Target: " << symLinkInfo.symLinkTarget(); return 0; }
#includeThis code snippet prompts the user to select a file using QFileDialog and creates a QFileInfo object. If the file is a symbolic link, its target is retrieved using symLinkTarget() function and printed to the console. Package library: Qt C++ library.#include #include int main() { QString filePath = QFileDialog::getOpenFileName(); QFileInfo fileInfo(filePath); if(fileInfo.isSymLink()) qDebug() << "Target: " << fileInfo.symLinkTarget(); return 0; }