當前位置:首頁 » Perl » Perl endpwent()函數

Perl endpwent()函數

perl endpwent()函數,endpwent()函數學習例子,endpwent()函數實例代碼,endpwent()函數教學等

語法

endpwent


定義和用法

讓你的係統不再期望使用getpwent從密碼文件中讀取條目。 在Windows下,使用的Win32API:: Net函數,從域名服務器得到的信息。

返回值

  • None

例子

試試下麵的例子:

#!/usr/bin/perl

while(($name, $passwd, $uid, $gid, $quota,
        $comment, $gcos, $dir, $shell) = getpwent()){
   print "Name = $name\n";
   print "Password = $passwd\n";
   print "UID = $uid\n";
   print "GID = $gid\n";
   print "Quota = $quota\n";
   print "Comment = $comment\n";
   print "Gcos = $gcos\n";
   print "HOME DIR = $dir\n";
   print "Shell = $shell\n";
}

setpwent() ; # Rewind the databse /etc/passwd

while(($name, $passwd, $uid, $gid, $quota,
        $comment, $gcos, $dir, $shell) = getpwent()){
   print "Name = $name\n";
   print "Password = $passwd\n";
   print "UID = $uid\n";
   print "GID = $gid\n";
   print "Quota = $quota\n";
   print "Comment = $comment\n";
   print "Gcos = $gcos\n";
   print "HOME DIR = $dir\n";
   print "Shell = $shell\n";
}

#by www.gitbook.net
endpwent(); # Closes the database;