首頁>Club>
8
回覆列表
  • 1 # 使用者9364575890814

    你是指C語言的庫函式 close 吧? 它是用來關閉檔案的,它的引數是呼叫 open 函式或者 create 函式成功後返回的檔案控制代碼,是一個整型變數。用 close 的時候需要

    #include

    舉例子:

    /**************************** 原始檔 eg.c ***********************************/

    #include

    #include

    #include

    /* 以上是呼叫 open 函式所需的標頭檔案 */

    #include

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

    int fd;

    if (argc == 1) {

    沒有檔名,報錯,或者提供一個預設的檔名;

    }

    fd = open(argv[1], O_RDWR);

    if(fd

    開啟失敗,報錯,退出;

    }

    /* 成功開啟檔案之後 */

    各種操作;

    close(fd);

    return(0);

    }

  • 中秋節和大豐收的關聯?
  • 汽車方向不穩定的原因是什麼?