From: | Colin Wenzel |
Date: | 25 Aug 2001 at 14:52:08 |
Subject: | [amiga-c] Re: Saving and reading structs |
> 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..
The data will need to be saved seperately & the pointer re-initialised
when you re-read the data.
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...
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....
Regards
Colin Wenzel. 157 Brisbane Road,
Mooloolaba, Queensland, Australia. 4557.
PHONE: (07) 5444 5445
EMAIL: colstv@yahoo.com.au
EMAIL2: colinwenzel@yahoo.com
URL: http://www.hotkey.net.au/~colstv/
AMIGA: 4000T, 68060/50, 150Mb RAM,
OS 3.9, Spectrum Gfx Card + P96.
Need an Image Generator For CATV ??
http://connect.to/products
________________________________________
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Do you need to encrypt all your online transactions? Secure corporate intranets? Authenticate your Web sites? Whatever
security your site needs, you'll find the perfect solution here!
http://us.click.yahoo.com/Bre3tC/Q56CAA/yigFAA/dpFolB/TM
---------------------------------------------------------------------~->
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/