powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / C++ [игнор отключен] [закрыт для гостей] / формат файла .hst FOREX-а
6 сообщений из 6, страница 1 из 1
формат файла .hst FOREX-а
    #33767629
muk07
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
В поисках формата файла истории курса (hst) нашёл:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
struct HistoryHeader
  {
   int               version;
   char              copyright[ 64 ];
   char              symbol[ 12 ];
   int               period;
   int               digits;
   time_t            timesign;
   time_t            last_sync;
   int               unused[ 13 ];
  };
//----
#pragma pack(push, 1 )
struct RateInfo
  {
   time_t            ctm;
   double            open;
   double            low;
   double            high;
   double            close;
   double            vol;
  };
#pragma pack(pop)
Кто знает что такое #pragma pack - в каком это компиляторе.
...
Рейтинг: 0 / 0
формат файла .hst FOREX-а
    #33767643
Станислав C.
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
muk07В поисках формата файла истории курса (hst) нашёл:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
struct HistoryHeader
  {
   int               version;
   char              copyright[ 64 ];
   char              symbol[ 12 ];
   int               period;
   int               digits;
   time_t            timesign;
   time_t            last_sync;
   int               unused[ 13 ];
  };
//----
#pragma pack(push, 1 )
struct RateInfo
  {
   time_t            ctm;
   double            open;
   double            low;
   double            high;
   double            close;
   double            vol;
  };
#pragma pack(pop)
Кто знает что такое #pragma pack - в каком это компиляторе.

MSDN-2000 Help
The #pragma pack directive is used by the MIDL compiler to control the packing of structures. It overrides the /Zp command-line switch. The pack (n) option sets the current pack size to a specific value: 1, 2, 4, 8, or 16. The pack (push) and pack (pop) options have the following characteristics:

The compiler maintains a packing stack. The elements of the packing stack include a pack size and an optional id. The stack is limited only by available memory with the current pack size at the top of the stack.
Pack (push) results in the current pack size pushed onto the packing stack. The stack is limited by available memory.
Pack (push, n) is the same as pack (push) followed by pack (n).
Pack (push, id) also pushes id onto the packing stack along with the pack size.
Pack (push, id, n) is the same as pack (push, id) followed by pack (n).
Pack (pop) results in popping the packing stack. Unbalanced pops cause warnings and set the current pack size to the command-line value.
If pack (pop, id, n) is specified, then n is ignored.
[quot автор]The #pragma pack directive is used by the MIDL compiler to control the packing of structures. It overrides the /Zp command-line switch. The pack (n) option sets the current pack size to a specific value: 1, 2, 4, 8, or 16. The pack (push) and pack (pop) options have the following characteristics:

The compiler maintains a packing stack. The elements of the packing stack include a pack size and an optional id. The stack is limited only by available memory with the current pack size at the top of the stack.
Pack (push) results in the current pack size pushed onto the packing stack. The stack is limited by available memory.
Pack (push, n) is the same as pack (push) followed by pack (n).
Pack (push, id) also pushes id onto the packing stack along with the pack size.
Pack (push, id, n) is the same as pack (push, id) followed by pack (n).
Pack (pop) results in popping the packing stack. Unbalanced pops cause warnings and set the current pack size to the command-line value.
If pack (pop, id, n) is specified, then n is ignored.
...
Рейтинг: 0 / 0
формат файла .hst FOREX-а
    #33767701
muk07
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Спасибо, но это мало мне помогло, главным образом потому что я не знаю что такое packing stack. Могу ли я читать этот файл, используя Borland-овский компилятор (С++Builder). Или pack означает сжатие на лету (вот такую ассоциацию вызывает это слово)
...
Рейтинг: 0 / 0
формат файла .hst FOREX-а
    #33767809
Станислав C.
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
muk07Спасибо, но это мало мне помогло, главным образом потому что я не знаю что такое packing stack. Могу ли я читать этот файл, используя Borland-овский компилятор (С++Builder). Или pack означает сжатие на лету (вот такую ассоциацию вызывает это слово)
Не совсем.
pack - это выравнивание элементов структур на границу байта (1), слова(2), двойного слова(4)...
С++ Builder Help
Syntax

#pragma pack([{push | pop}[,]] [identifier[,]] [n])

Description

The #pragma pack(n).directive is the same as using the #pragma option specifically with the -a compiler option. n is the byte alignment that determines how the compiler aligns data in stored memory. For more information see the -a compiler option. #pragma pack can also be used with push and pop arguments, which provide the same functionality as the #pragma option directive using push and pop. The following table compares the use of #pragma pack with #pragma option.

#pragma pack #pragma option

#pragma pack(n) #pragma option -an

#pragma pack(push, n) #pragma option push -an
#pragma pack(pop) #pragma option pop

The #pragma pack directive also supports an identifier argument which must be used in combination with either push or pop.

#pragma pack with no arguments

#pragma pack()

Using #pragma pack with no arguments will set the packing size to the starting –aX alignment (which defaults to 4). The starting -aX alignment is considered the alignment at the start of the compile AFTER all command-line options have been processed.

#pragma pack using a value for n

#pragma pack(8)

Using #pragma pack with a value for 'n' will set the current alignment to 'n'. Valid alignments for ‘n’ are: 1,2,4,8, and 16.

#pragma pack using push

#pragma pack(push)

Using #pragma pack with push will push the current alignment on an internal stack of alignments.

#pragma pack using push, identifier

#pragma pack(push, ident)

Using #pragma pack with push and an identifier will associate the pushed alignment with 'identifier'.

#pragma pack using push and n

#pragma pack(push, 8)

#pragma pack(push, ident, 8)

Using #pragma pack with push with a value for 'n', will execute pragma pack push or pragma pack push identifier, and afterwards set the current alignment to 'n'.

#pragma pack using pop

#pragma pack(pop)

Using #pragma pack with pop will pop the alignment stack and set the alignment to the last alignment pushed. If the pop does not find a corresponding push, the entire stack of alignments is popped, and a warning is issued, and the alignment reverts to the starting -aX alignment..

#pragma pack using pop, identifier

#pragma pop(pop, ident)

Using #pragma pack with pop and an identifier will pop the stack until the identifier is found and set the alignment to the alignment pushed by the previous corresponding #pragma pack(push, identifier). If the pop with identifier does not find the corresponding push with an identifier, the entire stack of alignments is popped, and a warning is issued to the user:

W8083: Pragma pack pop with no matching pack push

The alignment will then be reset to the starting -aX alignment.

#pragma pack using pop and n

#pragma pack(pop, 8)

#pragma pack(pop, ident, 8)

Using #pragma pack with pop and a value for 'n', will execute pragma pack pop or pragma pack pop identifier. Afterwards the current alignment is set to 'n', unless pop fails to find a corresponding push, in which case 'n' is ignored, a warning is issued, and the alignment reverts to the starting -aX alignment.

Error conditions

Specifying an 'identifier' without push or pop is an error.
Specifying an alignment different from 1,2,4,8,16 is an error.

Warning conditions

Using #pragma pop without a corresponding push issues a warning.
...
Рейтинг: 0 / 0
формат файла .hst FOREX-а
    #33767874
Dmitrii K.
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
muk07Спасибо, но это мало мне помогло, главным образом потому что я не знаю что такое packing stack. Могу ли я читать этот файл, используя Borland-овский компилятор (С++Builder). Или pack означает сжатие на лету (вот такую ассоциацию вызывает это слово)
В вашем случае, т.е. с выравниванием на границу байта (pack(1)), действительно результатом будет "сжатие" структуры. Типичный случай работы с типизированным файлом... В C++ Builder нормально работает (проверено, приходилось использовать).
...
Рейтинг: 0 / 0
формат файла .hst FOREX-а
    #33767976
muk07
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Вот теперь понятно, спасибо всем.
...
Рейтинг: 0 / 0
6 сообщений из 6, страница 1 из 1
Форумы / C++ [игнор отключен] [закрыт для гостей] / формат файла .hst FOREX-а
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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