Mail Archives: djgpp/1997/08/19/09:05:02
From: | "Kertis A. Henderson" <kah190 AT psu DOT edu>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Writing a struct to disk
|
Date: | Tue, 19 Aug 1997 02:00:39 -0400
|
Organization: | Penn State University, Center for Academic Computing
|
Lines: | 23
|
Message-ID: | <33F93687.14CE173@psu.edu>
|
NNTP-Posting-Host: | access-mkts1p15.mk.psu.edu
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Under djgpp, what is the best way to write a bunch of structs to a
file? For instance, I'd like to write a linked list to a file node by
node, then be able to read the nodes back and reconstruct the list. A
node could be something like the following:
struct node {
int number;
unsigned char age;
char *name;
node *next;
}
The ints and chars would be relatively easy, but I don't see how a
variable length string could be written. Of course, the node pointer
wouldn't be written.
If anybody could help me out (or possibly point me in the right
direction), I'd appreciate it. Thanks for any input.
--
Kertis Henderson
kah190 AT psu DOT edu
- Raw text -