Is this code "D-ish" enough?

lafoldes lafoldes at geemail.kom
Wed Aug 7 11:39:30 PDT 2013


On Wednesday, 7 August 2013 at 18:36:24 UTC, Justin Whear wrote:
> On Wed, 07 Aug 2013 20:25:33 +0200, lafoldes wrote:
>
>> 
>> There are things, I don'like here:
>> 
>> - the dummy repeat at the beginning of the component chain. 
>> The only
>> purpose of it is to produce the needed number of items. 
>> Moreover repeat
>> doesn't produce sortable range, so the array is needed as well.
>> - I don't know how to do this when the number of items is nor 
>> known. How
>> to repeat until EOF?
>> - The variables id, and lineNo outside the chain.
>> - rawRead() needs an array, even if there is only one item to 
>> read.
>> - How to avoid the flush() at the end?
>> 
>> What do you think?
>
> Is 0 present as an id in the file?  If not, you could treat the 
> file as a
> range of bytes, use lazy split('\0') on it, then use the peek 
> function
> from std.bitmanip to split each "line" into an integer-string 
> tuple.

Unfortunately id is not a string, it is an integer in binary 
form. So byte 0 is present...


More information about the Digitalmars-d-learn mailing list