Binary I/O for Newbie
Robert Jacques
sandford at jhu.edu
Mon Feb 27 10:36:34 PST 2012
On Mon, 27 Feb 2012 12:21:21 -0600, tjb <broughtj at 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 data in a structure like this:
>
> struct TaqIdx {
> char symbol[10];
> int tdate;
> int begrec;
> int endrec;
> }
>
> And I use an ifstream to cast the data to the structure in read. I'm
> struggling to get a handle on I/O in D. Can you give some pointers?
> Thanks so much!
>
> TJB
This is about the simplest way to read binary data in:
auto data = cast(TaqIdx[]) std.file.read(filename);
More information about the Digitalmars-d-learn
mailing list