Write struct to file

Ali Çehreli acehreli at yahoo.com
Sat Feb 25 15:28:46 PST 2012


On 02/25/2012 03:00 PM, Andrej Mitrovic wrote:
> On 2/25/12, Ali Çehreli<acehreli at yahoo.com>  wrote:
>> But there is no way for fwrite to follow name.ptr to also write the
>> characters that are in the string, right?
>
> Oh my I just got a big fat zero on the finals. You're absolutely
> right, what gets copied is the length and the pointer. The only reason
> my last sample worked is because the memory for the strings was
> allocated on the stack, which had the same address between runs.

Ha ha! :) Sorry, I wasn't clear before. That was exactly what I meant. 
Whenever I see objects written by &object, I hear warning bells. :)

Ali


More information about the Digitalmars-d-learn mailing list