Advanced Programming in the UNIX Environment: Second Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Advanced Programming in the UNIX Environment: Second Edition [Electronic resources] - نسخه متنی

W. Richard Stevens; Stephen A. Rago

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید



4.17. symlink and readlink Functions


[View full width]

#include <unistd.h>
int symlink(const char *

actualpath , const char
*

sympath );

Returns: 0 if OK, 1 on error

A new directory entry,

sympath , is created that points to

actualpath . It is not required that

actualpath exist when the symbolic link is created. (We saw this in the example at the end of the previous section.) Also,

actualpath and

sympath need not reside in the same file system.

Because the open function follows a symbolic link, we need a way to open the link itself and read the name in the link. The readlink function does this.

[View full width]

#include <unistd.h>
ssize_t readlink(const char* restrict

pathname ,
char *restrict

buf ,
size_t

bufsize );

Returns: number of bytes read if OK, 1 on error

This function combines the actions of open, read, and close. If the function is successful, it returns the number of bytes placed into

buf . The contents of the symbolic link that are returned in

buf are not null terminated.


    / 369