fileexists delphi



Автор Игорь Антонов задал вопрос в разделе Другие языки и технологии

как в delphi 7 определить есть ли в папке нужный файл? и получил лучший ответ

Ответ от Аццкий скорпиончег[гуру]
Как уже было отмечено, есть фукнция FileExists... Но, как утверждают знатоки, самым быстрым способом будет применение API-функции GetFileAttributes, которая возвращает атрибуты для заданного файла или каталога. В случае ошибки возвращается значение 0xFFFFFFFF. Поэтому, определить наличие файла или каталога можно так:
if GetFileAttributes(PAnsiChar('test.jpg')) <> DWORD(-1) then ShowMessage('Yes');

Ответ от Jurii[гуру]
Встроенный Help в Delphi 3 :
Unit
SysUtils
Category
File management routines
FileExists tests if FileName exists.
function FileExists(const FileName: string): Boolean;
Description
The FileExists function returns True if the file specified by FileName exists. If the file does not exist, FileExists returns False.
Example
The following code prompts for confirmation before deleting a file:
if FileExists(FileName) then
if MsgBox('Do you really want to delete ' + ExtractFileName(FileName)
+ '?'), []) = IDYes then DeleteFile(FileName);
Пишем в Delphi 7 команду FileExists и жмём Ctrl+F1… Видим результат:
Unit
SysUtils
Category
file management routines
Delphi syntax:
function FileExists(const FileName: string): Boolean;
C++ syntax:
extern PACKAGE bool __fastcall FileExists(const AnsiString FileName);
Description
FileExists returns true if the file specified by FileName exists. If the file does not exist, FileExists returns false.

Ответ от 3 ответа[гуру]
Привет! Вот подборка тем с похожими вопросами и ответами на Ваш вопрос: как в delphi 7 определить есть ли в папке нужный файл?
 

Ответить на вопрос:

Имя*

E-mail:*

Текст ответа:*
Проверочный код(введите 22):*