All,
I am just starting to learn D. I am an economist - not a
programmer, so I appreciate your patience with lack of knowledge.
I have some financial data in a binary file that I would like to
process. In C++ I have the data in a structure like this:
struct TaqIdx {
char symbol[10];
On Mon, 27 Feb 2012 12:21:21 -0600, tjb broug...@gmail.com wrote:
All,
I am just starting to learn D. I am an economist - not a programmer, so
I appreciate your patience with lack of knowledge.
I have some financial data in a binary file that I would like to
process. In C++ I have the
On Mon, 27 Feb 2012 19:21:21 +0100, tjb wrote:
All,
I am just starting to learn D. I am an economist - not a programmer, so
I appreciate your patience with lack of knowledge.
I have some financial data in a binary file that I would like to
process. In C++ I have the data in a structure
On 02/27/2012 10:21 AM, tjb wrote:
I have some financial data in a binary file that I would like to
process. In C++ I have the data in a structure like this:
struct TaqIdx {
char symbol[10];
int tdate;
int begrec;
int endrec;
}
The equivalent of that C++ (and C) struct would be almost
Doesn't the struct alignment play a role here?
On Mon, 27 Feb 2012 19:42:36 +0100, Tobias Brandt wrote:
Doesn't the struct alignment play a role here?
Good point. If the data is packed, you can toss an align(1) on the front
of the struct declaration.
On Monday, 27 February 2012 at 18:56:15 UTC, Justin Whear wrote:
On Mon, 27 Feb 2012 19:42:36 +0100, Tobias Brandt wrote:
Doesn't the struct alignment play a role here?
Good point. If the data is packed, you can toss an align(1) on
the front
of the struct declaration.
So, something like
So, something like this should work:
[...]
It really depends on how you wrote the file originally. If you
know that it is packed, i.e. 10+32+32+32=106 bytes per record,
then yes.
If you wrote to the file with a C++ program, then I guess the
compiler aligned the data so that the whole struct is
On 02/27/2012 11:27 AM, Tobias Brandt wrote:
So, something like this should work:
[...]
It really depends on how you wrote the file originally. If you
know that it is packed, i.e. 10+32+32+32=106 bytes per record,
then yes.
You meant 4 bytes per int. :)
If you wrote to the file with a
It really depends on how you wrote the file originally. If you
know that it is packed, i.e. 10+32+32+32=106 bytes per record,
then yes.
You meant 4 bytes per int. :)
Yep, good catch.
If you wrote to the file with a C++ program, then I guess the
compiler aligned the data so that the whole
On 02/27/2012 11:43 AM, Tobias Brandt wrote:
If you wrote to the file with a C++ program, then I guess the
compiler aligned the data so that the whole struct is 128 bytes
in size. Technically, the C++ compiler is allowed to do
anything short of changing the order of the struct fields.
That
On Monday, 27 February 2012 at 19:28:07 UTC, Tobias Brandt wrote:
So, something like this should work:
[...]
It really depends on how you wrote the file originally. If you
know that it is packed, i.e. 10+32+32+32=106 bytes per record,
then yes.
If you wrote to the file with a C++ program,
Just looked at my old C++ code. And the struct looks like this:
struct TaqIdx {
char symbol[10];
int tdate;
int begrec;
int endrec;
}__attribute__((packed));
So I am guessing I want to use the align(1) as Justin suggested. Correct?
Yes.
13 matches
Mail list logo