Chapter Contents

Previous

Next
readlink

readlink



Read Symbolic Link

Portability: POSIX.1 conforming, UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <unistd.h>

int readlink(const char *fn, char *buf, size_t size)


DESCRIPTION

readlink reads the contents of a symbolic link. fn is the pathname. buf is the buffer into which the information is read. size is the size of the buffer in bytes.

When you call readlink in a non- posix -compiled application, the link name is interpreted according to the normal rules for interpretation of file names. The name should include a style prefix if the default style is not "hfs" . Also, when readlink is called in a non- posix -compiled application, the value stored in buf has the style prefix "hfs:" prepended.


RETURN VALUE

readlink returns the number of bytes in the buffer, or the number of bytes in the symbolic link if the buffer size is stored into 0. readlink returns -1 if it is not successful.


EXAMPLE

The example for symlink also illustrates the use of readlink .


RELATED FUNCTIONS

symlink


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.