Tuesday, February 17, 2009

libc vs. glibc

[引用]
> Can anyone enlighten me on this: What is the difference between libc
> and glibc?

I'm sure half the people on this list can answer this :) - but here
goes.

Libc the C library that is used by basically every Linux/UNIX program to
talk to the kernel. Glibc is a version of Libc by the GNU project.

That doesn't really answer the question, though, because Linux
distributions used to come with 'libc5' and now they come with 'glibc2'
or 'libc6'. Glibc and libc6 refer to the same thing, and they are really
just a newer version of libc written by different people.
[/引用]

也就是说libc,libc6,glibc指的是同一个东西:POSIX,ISO C等函数库。而不是libc仅指ISO C函数库。
glibc-doc也就是libc6的文档。manpages-dev提供了man参考。

Thursday, February 12, 2009

荒唐的“文件结束符”

根本没有什么文件结束符。
如果有的话空文件不是还要占一个字节的结束符?
EOF是什么?它就是-1。它不过是C例程里的一个常量,当碰到文件结尾时,就返回-1。

问题的根本是你错误的认为磁盘的文件结尾还有一个字符专门表示文件的结束,呵呵,没有这个字符,你想啊,每读一个字符还要比较一下它是否等于“空想的文件结束符“,是不是太低效了点呢。那是如何判断文件是否已经结束的?中断、异常。