與getpwnam配套使用的一個函式。
基本介紹
- 外文名:endpwent
- 套用領域:計算機
- 相關函式:getpwnam
與getpwnam配套使用的一個函式。
endpwent()函式原型是void endpwent(void);。頭檔案 #include #include 函式原型 void endpwent(void);說明 endpwent()用來關閉由getpwent()所打開的密碼檔案。The endpwent() function may be called to close the user database when processing is complete.範例 #include #include int main(){ struct passwd *p...
getpwent()在第一次調用時會打開密碼檔案,讀取數據完畢後可使用endpwent()來關閉該密碼檔案。錯誤代碼ENOMEM 記憶體不足,無法配置passwd結構。返回值 返回passwd 結構數據,如果返回NULL 則表示已無數據,或有錯誤發生。範例 #include #include main(){ struct passwd *user;while((user = getpwent())!=0){ printf...
“%s :%d :%d :%s:%s:%s\n”,user->pw_name,user->pw_uid,user->pw_gid,user->pw_gecos,user->pw_dir,user->pw_shell);endpwent();} 執行 root:0:0:root:/root:/bin/bash bin:1:1:bin:/bin daemon:2:2:daemon:/sbin adm:3:4:adm:/var/adm root:0:0:root:/root:/bin/bash ...
8.4 endpwent函式:關閉系統口令函式 8.5 endutent函式:關閉utmp檔案 8.6 fgetgrent函式:從檔案中讀取組數據 8.7 fgetpwent函式:從檔案中讀取密碼格式數據 8.8 getegid函式:獲得有效(effective gid)組識別符 8.9 getenv函式:取得環境變數的值 8.10 geteuid函式:獲得有效(effective uid)用戶識別符 8.11 ...
