重新用C code presenting EOF? [英] Representing EOF in C code?

查看:136
本文介绍了重新用C code presenting EOF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在换行符是重新通过 psented $ P $\\ n用C code。是否有最终的文件(EOF)字符等效?

The newline character is represented by "\n" in C code. Is there an equivalent for the end-of-file (EOF) character?

推荐答案

EOF不是字符(在大多数现代操作系统)。这只不过是一个适用于一个文件流到达流的末尾时的条件。产生了困惑,因为用户可能的信号的EOF控制台输入通过输入特殊字符(如控制-D在UNIX,LINUX,的的),但这个人物不是通过正在运行的程序可见,它是由操作系统反过来信号EOF到处理捕获

EOF is not a character (in most modern operating systems). It is simply a condition that applies to a file stream when the end of the stream is reached. The confusion arises because a user may signal EOF for console input by typing a special character (e.g Control-D in Unix, Linux, et al), but this character is not seen by the running program, it is caught by the operating system which in turn signals EOF to the process.

请注意:在一些很老的操作系统EOF的的字符,例如控制-Z在CP / M,但这是一个黑客原油,以避免文件系统目录维持实际文件长度的开销。

Note: in some very old operating systems EOF was a character, e.g. Control-Z in CP/M, but this was a crude hack to avoid the overhead of maintaining actual file lengths in file system directories.

这篇关于重新用C code presenting EOF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆