luocolor 发表于 2006-10-9 18:12:30

Where is the *.c

When programming,need lots of .h ,but where is the *.c file associated to the .h.
I find "extern" in many file.
eg.debian:/usr/include# cat stdio.h |grep extern
extern int rename (__const char *__old, __const char *__new) __THROW;

where can i get the implement of rename?
(implement in some .so?) :oops:

ro4tub 发表于 2006-10-17 11:52:27

you should check the glibc library.

the following is from it:


/* Rename the file OLD to NEW.*/
int
rename (old, new)
   const char *old;
   const char *new;
{
int save = errno;
if (__link (old, new) < 0)
    {
      if (errno == EEXIST)
        {
          __set_errno (save);
          /* Race condition, required for 1003.1 conformance.*/
          if (__unlink (new) < 0 ||
              __link (old, new) < 0)
          return -1;
        }
      else
        return -1;
    }
if (__unlink (old) < 0)
    {
      save = errno;
      if (__unlink (new) == 0)
        __set_errno (save);
      return -1;
    }
return 0;
}
页: [1]
查看完整版本: Where is the *.c