www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Simple reading of binary data

reply "Matt" <webwraith fastmail.fm> writes:
I'm having real trouble reading binary data from a file. I've 
been trying to use the functions from std.stdio, but keep running 
into problems. When I try;

byte b;
auto file = new File( "some binary file" );
file.readf( "%d", &b );

I get "Unexpected '€' when converting from type 
LockingTextReader to type int"
What functions do I use to read individual bytes, shorts, ints, 
longs and the like?
Oct 27 2012
parent "Matt" <webwraith fastmail.fm> writes:
On Saturday, 27 October 2012 at 11:06:09 UTC, Matt wrote:
 I'm having real trouble reading binary data from a file. I've 
 been trying to use the functions from std.stdio, but keep 
 running into problems. When I try;

 byte b;
 auto file = new File( "some binary file" );
 file.readf( "%d", &b );

 I get "Unexpected '€' when converting from type 
 LockingTextReader to type int"
 What functions do I use to read individual bytes, shorts, ints, 
 longs and the like?

And I've just managed to find the previous post on this topic. Sorry for wasting peoples time
Oct 27 2012