作者使用了自己的標頭檔案,導致每次都要匯入整個標頭檔案,而不知道具體的函式存在於哪個標頭檔案中。 其實,我們可以使用man 把函式或結構 變數 所在的標頭檔案找出來,然後包含進去。 比如要找到opendir所在的標頭檔案,就可以用:man opendir
man opendir
opendir(3) linux programmer's manual opendir(3)
name
opendir, fdopendir -open a directory
synopsis
#include
#include
dir *opendir(const char *name);
dir *fdopendir(int fd);
synopsis中顯示的就是包含該函式的標頭檔案,man 後面也可以帶個數字引數,2 表示查詢的是系統函式,3表示查詢的是庫函式。
《Unix環境高階程式設計》準備apue h
unix環境高階程式設計 的第乙個程式1 1,編譯報告找不到apue.h,解決方法 2.解壓 tar zxvf src.2e.tar.gz 3.進入解壓目錄,修改make.defines.linux中的wkdir home apue.2e,為wkdir cygdrive d unixprogramm...
Unix環境高階程式設計學習筆記之程序環境(1)
學完uml後開始繼續學習linux環境下的程式設計,apue很厚,我直接挑我最感興趣的幾章開始學習,今天學習了程序環境有關的知識,遇到了很多以前從未想過的問題,在這做個筆記做個記錄。程序環境主要要討論的問題就是當程式執行時,main函式是如何被呼叫的,命令列引數是如何傳遞給新程式的,典型的儲存空間布...
《unix環境高階程式設計》筆記2
第四章 檔案和目錄 本章將描述檔案系統特徵和檔案性質 1 stat fstat和lstat函式 原型 include int stat const char restrict pathname,struct stat restrict buf int fstat int filedes,struct...