/* ************************************************************************
* Filename: open.c
* Description:
* Version: 1.0
* Created: 2011年07月18日 18时54分51秒
* Revision: none
* Compiler: gcc
* Author: YOUR NAME (),
* Company:
* ***********************************************************************
*/


#include
<stdio.h>
#include
<stdlib.h>
#include
<unistd.h>
#include
<string.h>
#include
<fcntl.h>


int main(int argc, char *argv[])
{

int fd;
char str[100];

fd
= open("cd.txt",O_RDONLY);

if(fd < 0)
{
perror(
"open");
}

while(read(fd,str,sizeof(str)) > 0)
{
printf(
"%s",str);
}


return 0;
}

  

相关文章:

  • 2021-11-28
  • 2021-04-03
  • 2021-05-21
  • 2022-01-02
  • 2022-02-23
  • 2021-09-14
  • 2022-12-23
  • 2021-11-20
猜你喜欢
  • 2021-10-30
  • 2022-01-09
  • 2022-12-23
  • 2021-12-11
  • 2021-12-15
  • 2021-09-14
  • 2022-12-23
相关资源
相似解决方案