⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 列表7.6.txt

📁 klinux书籍的配套光盘。可以学习学习。
💻 TXT
字号:
【列表7.6】fileinfo应用程序的选择方法。
procedure Tform1.populateFileList;
Var
      searchRec: TSearchRec;
      rv: Integer;
      savedCursor: TCursor;
begin
      savedCursor := Screen.Cursor;
      Screen. Cursor := crHourGlass;
     lbFiles.Clear;
     rv := FindFirst( String( tbDirectory.Text ) + '/*',
                               faAnyFile, searchRec );
     while ( rv = 0 ) do
           begin
           lbFiles.items.Add( searchRec. Name );
           rv := FindNext( searchRec );
           end;
      FindClose( searchrec );
      lbFiles.ClearSelection;
      Screen. Cursor := savedCursor;
end;

procedure TForml.lbFilesClick(Sender: TObject);
var
      rv: Integer;
      filename: String;
      statbuf: TStatBuf;
      passrec: PPasswordRecord;
      grprec: PGroup;
begin
     // get the details for the selected file and fill in the form
     filename := constructFilename;
     rv := lstat( PChar( filename ), statBuf );
     if ( rv = -1 ) then
           begin
           ShowMessage( 'Unable to stat file.' );
           exit;
           end;
           // display the file's inode number
     lblInode. Caption := IntToStr(statBuf.st_ino );
           // display the mode (type) of the file
    if ( S_ISDIR(statBuf.st_mode) = true ) then
           lblType. Caption := 'Directory'
    else if ( S_ISCHR(statBuf.st_mode) = true ) then
           lblTyPe. Caption := 'Character device'
    else if ( S_ISBLK(statBuf.st_mode) = true ) then
           lblType. Caption := 'Block device'
    else if ( S_ISREG(statBuf.st_mode) = true ) then
          lblType. Caption := 'Regular file'
    else if ( S_ISFIFO(statBuf.st_mode) = true ) then
          lblType.Caption := 'FIFO'
    else if ( S_ISLNK(statBuf.st_mode) = true ) then
          lblType. Caption := 'Symbolic link'
    else if ( S_ISSOCK( statBuf.st_mode ) = true ) then
          lblType. Caption := 'Socket'
    else
          lblType. Caption := 'Unknown...';
     // display the file size
    lbtSize.Caption :m IntToStr(tatBuf.st_size);
          // display the owner of the file
    passrec := getpwuid( statBuf.st_uid );
    lblOwner. Caption := passrec.pw_name;
          // display the group of the file
    grprec := getgrgid( statBuf.st_gid );
    lblGroup.caption := grprec.gr_name;
          // display the last modification time of the file
    lblModified. Caption := crime( Addr( statBuf.st_mtime )
end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -