Writing linked lists to a file
John Gordon
gordon at osiris.cso.uiuc.edu
Wed Jan 23 07:37:45 AEST 1991
If you don't mind the data file being in binary format, you might try
something like this:
for(node = head; node; node++)
fwrite(node, sizeof(node), 1, fileptr);
However, you will probably have a problem writing the pointers to a
file, because when you load the nodes back in from disk, they will probably
not be in the same address as before.
---
John Gordon
Internet: gordon at osiris.cso.uiuc.edu #include <disclaimer.h>
gordon at cerl.cecer.army.mil #include <clever_saying.h>
More information about the Comp.lang.c
mailing list