Форум: "Основная";
Текущий архив: 2003.04.10;
Скачать: [xml.tar.bz2];
Вниз
перебрать все файлы *.txt Найти похожие ветки
← →
sagchat (2003-03-31 13:05) [0]Добрый день!
Как мне зделать чтобы например по нажатию кнопки перебрать все файлы *.txt в тойже папке что и программа и скопировать первую строку в MEMO.
Заранее благодарен!
← →
Андрей Сенченко (2003-03-31 13:07) [1]ParamStr(0)
FindFirst
FindNext
я первый ?
← →
Apachi (2003-03-31 13:07) [2]Используй TFileListBox у него есть своиство Mask=*.txt
← →
sagchat (2003-03-31 13:13) [3]Я начинающий, можно по подробнее(
желательно кодом
)!
← →
Андрей Сенченко (2003-03-31 13:57) [4]Подробнее ?
Можно и подробнее.
ParamStr function
Unit
System
Category
command line utilities
function ParamStr(Index: Integer): string;
Description
ParamStr returns the parameter from the command line that corresponds to Index, or an empty string if Index is greater than ParamCount. For example, an Index value of 2 returns the second command-line parameter.
ParamStr(0) returns the command used to execute the program, without parameters (for example, ./myprogram). This behavior is dependent on information returned by the shell program and may not be consistent among all shells.
FindFirst function
Searches for the first instance of a file name with a given set of attributes in a specified directory.
Unit
SysUtils
Category
file management routines
function FindFirst(const Path: string; Attr: Integer; var F: TSearchRec): Integer;
Description
FindFirst searches the directory specified by Path for the first file that matches the file name implied by Path and the attributes specified by the Attr parameter. The result is returned in the F parameter. Use the fields of this search record to extract the information needed. FindFirst returns 0 if a file was successfully located, otherwise, it returns an error code.
The Path constant parameter is the directory and file name mask, including wildcard characters.
The Attr parameter specifies the special files to include in addition to all normal files. Choose from these file attribute constants when specifying the Attr parameter:
Constant Value Description
faReadOnly $00000001 Read-only files
faHidden $00000002 Hidden files
faSysFile $00000004 System files
faVolumeID $00000008 Volume ID files
faDirectory $00000010 Directory files
faArchive $00000020 Archive files
faAnyFile $0000003F Any file
Attributes can be combined by adding their constants or values. For example, to search for read-only and hidden files in addition to normal files, pass (faReadOnly + faHidden) as the Attr parameter.
Note: FindFirst allocates resources (memory) which must be released by calling FindClose.
Note: Some of the file attribute constants are not valid on all platforms. For example, faVolumneID and faArchive will not work on Linux.
FindNext function
Returns the next entry matching the name and attributes specified in a previous call to FindFirst.
Unit
SysUtils
Category
file management routines
function FindNext(var F: TSearchRec): Integer;
Description
FindNext returns the next entry that matches the name and attributes specified in a previous call to FindFirst. The search record must be one that was passed to FindFirst. The return value is zero if the function was successful. Otherwise the return value is an error code.
← →
Андрей Сенченко (2003-03-31 13:57) [5]Можно и с кодом, но тогда Тебе будет сложнее научиться чему-либо
← →
sagchat (2003-03-31 14:20) [6]Андрей Сенченко ©
Но после этого я тоже врятли чему научусь
← →
Dimka Maslov (2003-03-31 14:21) [7]http://delphibase.endimus.com/?action=viewfunc&topic=fileops&id=10046
А затем
FindFiles(ExtractFilePath(Application.ExeName), "*.txt", Memo1.Lines, false);
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2003.04.10;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.008 c