Unix环境编程笔记3.pdfVIP

  • 3
  • 0
  • 约9.38千字
  • 约 21页
  • 2017-07-20 发布于浙江
  • 举报
Unix环境编程笔记3

day3 linux 文件系统 1.文件 一切都是文件 - /dev/console 控制台 - /dev/tty 终端 (键盘,显示器。。。。) - /dev/null 空设备文件(unix 黑洞) cat /dev/null a.txt 相当于清空a.txt find 找 open.c #includestdio.h #includefcntl.h #includesys/types.h #includesys/stat.h int main() { int fd = open( a.txt ,O_RDWR | O_CREAT,0666 ); if(fd == -1) { perror( failed ); exit(1); } printf( 打开成功fd = %d\n ,fd); int fd2 = open( b.txt ,O_RDWR | O_CREAT | O_TRUNC /*| O_EXEC*/,0666) ; if(fd2 == -1) { perror( 创建文件失败 ) ; exit(-1

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档