Версия для печати темы

Нажмите сюда для просмотра этой темы в обычном формате

Форум «Всё о Паскале» _ Задачи _ Работа с файлами

Автор: Катя 10.05.2006 20:21

Помогите!
Как вывести на экран атрибуты файла?

Автор: Бродяжник 10.05.2006 21:02

Для 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