Must be asleep this is less than clear Email
Owen
On 01-Jul-01 oms101@freeuk.com wrote:
On 30-Jun-01 David Freeman wrote:
C wizards,
If I write a structure to disk using fwrite(), what happens about pointers to structers? does the pointer or what its pointing at get saved?
Thanks
D
sorry for playing man pages but
<quote>
size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream);
The function fwrite writes nmemb elements of data, each size bytes long, to the stream pointed to by stream, obtaining them from the location given by ptr.
</quote>
cleaned up text
so I would suggest that the pointer you put in ptr would not be writtern out but the data it pointed to. I generally deal with text and so this has never been an issue for me but I do warn you that if you do not know your data file sizes in advance for your structure this could get hairy.
I am such an XML biggot that I barely write things that are not XML related, though I just did some text processing to take the track listings from CD's in grip and ~/.cddb and turn them into postscript the correct size for printing using groff for postscript generation.
Owen
Date: 01-Jul-01 Time: 01:08:58