Newbie: Error parsing csv file with very long lines

salvari via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 23 04:33:10 PDT 2016


On Saturday, 23 April 2016 at 11:18:08 UTC, rikki cattermole 
wrote:
> On 23/04/2016 10:57 PM, salvari wrote:
>> Fixed!!!
>>
>> Thanks a lot. :-)
>>
>>
>> But I have to think about this. I don't understand the failure.
>
> .dup duplicates memory.
> What this means is, it allocates a new block of memory and 
> copies the values across.
>
> What byLine does is, read up to \n and copies it into a buffer 
> of memory.
> Then you get access to said buffer aka line.
> So it reuses the memory containing said line, meaning no 
> allocations beyond the first and growth of it.

Now I understand. Slices are still biting me every now and then.


More information about the Digitalmars-d-learn mailing list