TypeScript API Documentation for GLIB
API Version: 2.0
Library Version: 2.86.4
Generated with TypeDoc via ts-for-gir v4.0.0-beta.40
Since 2.4
Reads the contents of the symbolic link filename like the POSIX readlink() function.
filename
readlink()
The returned string is in the encoding used for filenames. Use g_filename_to_utf8() to convert it to UTF-8.
g_filename_to_utf8()
The returned string may also be a relative path. Use g_build_filename() to convert it to an absolute path:
g_build_filename()
g_autoptr(GError) local_error = NULL;g_autofree gchar *link_target = g_file_read_link ("/etc/localtime", &local_error);if (local_error != NULL) g_error ("Error reading link: %s", local_error->message);if (!g_path_is_absolute (link_target)) { g_autofree gchar *absolute_link_target = g_build_filename ("/etc", link_target, NULL); g_free (link_target); link_target = g_steal_pointer (&absolute_link_target); } Copy
g_autoptr(GError) local_error = NULL;g_autofree gchar *link_target = g_file_read_link ("/etc/localtime", &local_error);if (local_error != NULL) g_error ("Error reading link: %s", local_error->message);if (!g_path_is_absolute (link_target)) { g_autofree gchar *absolute_link_target = g_build_filename ("/etc", link_target, NULL); g_free (link_target); link_target = g_steal_pointer (&absolute_link_target); }
the symbolic link
A newly-allocated string with the contents of the symbolic link, or null if an error occurred.
null
2.4
Reads the contents of the symbolic link
filenamelike the POSIXreadlink()function.The returned string is in the encoding used for filenames. Use
g_filename_to_utf8()to convert it to UTF-8.The returned string may also be a relative path. Use
g_build_filename()to convert it to an absolute path: