Chapter 1. General Unix and Advanced C

 

Chapter 1. General Unix and Advanced C

Everything is a file!

If you learn nothing else, you should remember that in UNIX everything is a file.

Imagine a file in the context something familiar like a word processor. There are two fundamental operations we can use on this imaginary word processing file

  1. Read it (existing saved data from the word processor).

  2. Write to it (new data from the user).

Now consider some of the common things attached to a computer and how they relate to our fundamental file operations.

  1. The screen

  2. The keyboard

  3. A printer

  4. A CDROM

The screen and printer are both like a write-only file, but instead of being stored as bits on a disk the information is displayer as dots on a screen or lines on a page. The keyboard is like a read only file with the data coming from keystrokes and the CDROM is similar but rather than randomly coming from the user the data is stored directly on the disk.

Thus a file is a good abstraction of all the devices attached to the computer. Some files may be read-only, or write-only, or indeed both.


 

原文链接:http://bottomupcs.sourceforge.net/csbu/c57.htm

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值