zoukankan      html  css  js  c++  java
  • LINUX C例程1:open的用法

    /* ************************************************************************
    * 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;
    }

      

  • 相关阅读:
    单元测试
    软件测试计划
    软件杯A9的设计与实现
    阅读笔记7
    阅读笔记6
    阅读笔记5
    阅读笔记4
    阅读笔记3
    阅读笔记2
    阅读笔记1
  • 原文地址:https://www.cnblogs.com/hnrainll/p/2109368.html
Copyright © 2011-2022 走看看