Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / C++ [игнор отключен] [закрыт для гостей] / Чтение файлов из директории / 10 сообщений из 10, страница 1 из 1
06.10.2006, 10:27
    #34036753
needjava
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Чтение файлов из директории
Уважаемая общественность! Подскажите плз, у меня билдер6.0. мне нужно из директории считывать файлы (по очереди). Как это сделать лучше?
...
Рейтинг: 0 / 0
06.10.2006, 10:31
    #34036764
Карабас Барабас
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Чтение файлов из директории
needjava n> Уважаемая общественность! Подскажите плз, у меня
n> билдер6.0. мне нужно из директории считывать файлы (по
n> очереди). Как это сделать лучше?RTFM FindFirst, FindNext, TSearchRec (если непременно билдер)
А вобще, в винапи есть функции. VCL-шные же функции лишь обертки
Posted via ActualForum NNTP Server 1.3
...
Рейтинг: 0 / 0
06.10.2006, 10:35
    #34036774
needjava
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Чтение файлов из директории
У меня нет документации, только соответствующие
заголовочные файлы - по ним же искать долго.
...
Рейтинг: 0 / 0
06.10.2006, 10:54
    #34036833
needjava
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Чтение файлов из директории
FindFirst - требует имя файла, а я его не знаю - мне надо считать все фалы из известной директории
...
Рейтинг: 0 / 0
06.10.2006, 10:57
    #34036844
q
q
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Чтение файлов из директории
...
Рейтинг: 0 / 0
06.10.2006, 11:04
    #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
06.10.2006, 12:04
    #34037136
needjava
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Чтение файлов из директории
TFileListBox - это какой include должен быть?
...
Рейтинг: 0 / 0
06.10.2006, 12:10
    #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
06.10.2006, 12:26
    #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
06.10.2006, 14:59
    #34037988
needjava
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Чтение файлов из директории
Спасибо! я разобрался!
...
Рейтинг: 0 / 0
Форумы / C++ [игнор отключен] [закрыт для гостей] / Чтение файлов из директории / 10 сообщений из 10, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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