Помощь - Поиск - Пользователи - Календарь
Полная версия: Работа с файлами
Форум «Всё о Паскале» > Pascal, Object Pascal > Задачи
Катя
Помогите!
Как вывести на экран атрибуты файла?
Бродяжник
Для Turbo/Borland Паскаля - процедура GetFAttr().
uses Dos;
var
  f: file;
  attr: Word;
  c: string;
begin
  c := 'my_file.asd';

  Assign(f, c);
  GetFAttr(f, attr);

  if DosError <> 0 then
    WriteLn('Dos error code = ', DosError)
  else
  begin
    Writeln('File: ',c);
    Writeln('Attribute = ', attr);
    { Determine file attribute type
      using flags in Dos unit }
    if attr and ReadOnly <> 0 then
      WriteLn('read only file');
    if attr and Hidden <> 0 then
      WriteLn('hidden file');
    if attr and SysFile <> 0 then
      WriteLn('system file');
    if attr and VolumeID <> 0 then
      WriteLn('volume ID');
    if attr and Directory <> 0 then
      WriteLn('directory name');
    if attr and Archive <> 0 then
      WriteLn('archive (normal file)');
  end; { else }
end.

Вообще-то, это пример из стандартной Паскалевской справки. !low.gif
Это текстовая версия — только основной контент. Для просмотра полной версии этой страницы, пожалуйста, нажмите сюда.