powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / C++ [игнор отключен] [закрыт для гостей] / Чтение файлов из директории
10 сообщений из 10, страница 1 из 1
Чтение файлов из директории
    #34036753
needjava
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Уважаемая общественность! Подскажите плз, у меня билдер6.0. мне нужно из директории считывать файлы (по очереди). Как это сделать лучше?
...
Рейтинг: 0 / 0
Чтение файлов из директории
    #34036764
Карабас Барабас
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
needjava n> Уважаемая общественность! Подскажите плз, у меня
n> билдер6.0. мне нужно из директории считывать файлы (по
n> очереди). Как это сделать лучше?RTFM FindFirst, FindNext, TSearchRec (если непременно билдер)
А вобще, в винапи есть функции. VCL-шные же функции лишь обертки
Posted via ActualForum NNTP Server 1.3
...
Рейтинг: 0 / 0
Чтение файлов из директории
    #34036774
needjava
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
У меня нет документации, только соответствующие
заголовочные файлы - по ним же искать долго.
...
Рейтинг: 0 / 0
Чтение файлов из директории
    #34036833
needjava
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
FindFirst - требует имя файла, а я его не знаю - мне надо считать все фалы из известной директории
...
Рейтинг: 0 / 0
Чтение файлов из директории
    #34036844
q
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
q
Гость
...
Рейтинг: 0 / 0
Чтение файлов из директории
    #34036880
needjavaУважаемая общественность! Подскажите плз, у меня билдер6.0. мне нужно из директории считывать файлы (по очереди). Как это сделать лучше?
Например, так (Borland C++ Builder 5):
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
//На форму Form1 брошены компоненты:
//TLabel и TFileListBox

void FilesFromDirectory(AnsiString FilePath)
{
  AnsiString Soob,filename,FileName;
  int nPosRoot;

  Form1->FileListBox1->Mask="*.txt";
  Form1->FileListBox1->ApplyFilePath(FilePath);
  Form1->FileListBox1->Refresh();
  for(int i= 0 ;i<Form1->FileListBox1->Items->Count;i++)
   {
      Form1->FileListBox1->ItemIndex=i;
      filename=Form1->FileListBox1->FileName;
      nPosRoot=Form1->FileListBox1->FileName.LastDelimiter("\\")+ 1 ;

      // На Label'e отражается с каким файлом работает программа
      Form1->Label1->Caption="Анализирую: ";
      Form1->Label1->Caption+=Form1->FileListBox1->FileName.SubString(nPosRoot,Form1->FileListBox1->FileName.Length()-nPosRoot+ 1 );
      Form1->Label1->Refresh();
  //здесь пишем остальную работу с файлами
  ...
  }

 Soob="Проверка выполнена!";
 ShowMessage(Soob);
 Form1->Label1->Caption="";
 Form1->Label1->Refresh();
}

Все непонятки ищите в Хелпе.
...
Рейтинг: 0 / 0
Чтение файлов из директории
    #34037136
needjava
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
TFileListBox - это какой include должен быть?
...
Рейтинг: 0 / 0
Чтение файлов из директории
    #34037160
Карабас Барабас
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Еще вариант:
Win SDKAn application sends an LB_DIR message to add a list of filenames to a list box .

LB_DIR
wParam = (WPARAM) (UINT) uAttrs; // file attributes
lParam = (LPARAM) (LPCTSTR) lpszFileSpec; // filename address


Parameters

uAttrs

Value of wParam. Specifies the attributes of the files to be added to the list box. This parameter can be a combination of the following values:

Value Description
DDL_ARCHIVE Includes archived files.
DDL_DIRECTORY Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]).
DDL_DRIVES Includes drives. Drives are listed in the form [-x-], where x is the drive letter.
DDL_EXCLUSIVE Includes only files with the specified attributes. By default, read-write files are listed even if DDL_READWRITE is not specified.
DDL_HIDDEN Includes hidden files.
DDL_READONLY Includes read-only files.
DDL_READWRITE Includes read-write files with no additional attributes.
DDL_SYSTEM Includes system files.


lpszFileSpec

Value of lParam. Points to the null-terminated string that specifies the filename to add to the list. If the filename contains wildcards (for example, *.*), all files that match the wildcards and have the attributes specified by the uAttrs parameter are added to the list.



Return Values

The return value is the zero-based index of the last filename added to the list. If an error occurs, the return value is LB_ERR. If there is insufficient space to store the new strings, the return value is LB_ERRSPACE.
Posted via ActualForum NNTP Server 1.3
...
Рейтинг: 0 / 0
Чтение файлов из директории
    #34037223
needjavaTFileListBox - это какой include должен быть?
C++Builder 5 Help
TFileListBox is a specialized list box that lists all the files in a specified directory.

Unit
filectrl

Description

Add TFileListBox to a form to allow users to select a file. Use TFileListBox along with TDriveComboBox, TFilterComboBox, and TDirectoryListBox to add full file selection capabilities to a form.

Note: To add a standard Windows file open or save dialog to an application, use TOpenDialog or TSaveDialog instead.


Поэтому:
Код: plaintext
1.
#include <FileCtrl.hpp>
...
Рейтинг: 0 / 0
Чтение файлов из директории
    #34037988
needjava
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Спасибо! я разобрался!
...
Рейтинг: 0 / 0
10 сообщений из 10, страница 1 из 1
Форумы / C++ [игнор отключен] [закрыт для гостей] / Чтение файлов из директории
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]