Amiga-C (185/223)

From:Jack York
Date:25 Aug 2001 at 11:57:40
Subject:[amiga-c] Re: Saving and reading structs

Hello Colin

On 25-Aug-01, Colin Wenzel wrote:
>> On Fri, 24 Aug 2001, Jack York wrote:
>>
>> Thanks for the suggestion Colin. I normally use the method you
>> describe but in this instance I'm using char * and allocating as
>> needed since the length of the strings being stored vary
>> significantly and I'm not always sure of what the maximum size will
>> be (like a path to a file).
>
> Unfortunately saving just the pointer to the data doesn't save the
> actual string, the pointer will point to a buffer somewhere that
> won't automatically be saved when you Write() the structure to a file..

Yes, I understand this.

> Also, saving variable length data will cause a problem with having
> random access through the file records, you will need to use a
> reserved delimiter or something to seperate the records...
> oow - messy...

I'm not using random reads in this case so that part won't cause a problem.

> You would be much safer & easier to just declare a maximum record
> space & be done with it, it will be offset by the trouble doing it any
> other way that may - MAY - save a few bytes of file size....

I considered that. But if I asked you to give me a buffer size that would
be large enough to hold the path to any file on _my_ drive what would it be?
That's the problem - there's no limit AFAIK.

Jack



E-Mail: jyork@twmi.rr.com
Alt: jyork@voyager,net
Home: http://my.voyager.net/~jyork

------------------------ Yahoo! Groups Sponsor ---------------------~-->
The Nissan Sentra
Everything but compact
http://NissanDriven.com
http://us.click.yahoo.com/3vsIKC/txlCAA/ySSFAA/dpFolB/TM
---------------------------------------------------------------------~->

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/