getpwnam.c
来自「UNIX环境高级编程书的源代码」· C语言 代码 · 共 17 行
C
17 行
#include <pwd.h>#include <stddef.h>#include <string.h>struct passwd *getpwnam(const char *name){ struct passwd *ptr; setpwent(); while ((ptr = getpwent()) != NULL) if (strcmp(name, ptr->pw_name) == 0) break; /* found a match */ endpwent(); return(ptr); /* ptr is NULL if no match found */}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?