🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Chris Vaughn-Uding Sun, 13 Sep 1998 00:00
Need notes from class- void read_load_list(...)
#159
Author: Chris Vaughn-Uding
Date: Sun, 13 Sep 1998 00:00
10 lines
922 bytes
I've been having a little bit of trouble reading my notes about reading in
from a file to a linked list. I'm getting confused on which parts are DNM
and NDNM. If anyone has either method I would appreciate if they could post
it. My notes list the function name as
void read_load_list(SLLnode *&headptr, char infile[ ])
We wrote the whole thing out in class and it would help give me some
direction on assn#2.

Thanks,
Chris Vaughn
Re: Need notes from class- void read_load_list(...)
#161
Author: Melissa Jackson
Date: Tue, 15 Sep 1998 00:00
50 lines
1773 bytes
Here is what I had in my notes.  We had not gone into DNM and NDNM when we did
this example.  So this is the NDNM.

//Given: Variable to hold head pointer, filename
//Result: Read contents file, store in linked list whose first node is pointed
to by headptr
void Read_Load_list(SLLnode *&headptr, charinfile[])
{
ifstream in;
bool first=TRUE;
SLLnode *newptr, *prevptr;
int temp;
//open file
in.open(infile);
in>>temp;
while(!in.eof())
{
newptr=new SLLnode;
newptr->field1=temp;
//Read
in>>newptr->field2>>newptr->field3;
newptr->next=NULL;
if(first)
{
headptr=newptr;
first=FALSE;
}
else
{
prevprt->next=newptr;
}
prevptr=newptr;
in>>temp;
}//while
in.close();
}//Read_Load_List


Chris Vaughn-Uding wrote:

> I've been having a little bit of trouble reading my notes about reading in
> from a file to a linked list. I'm getting confused on which parts are DNM
> and NDNM. If anyone has either method I would appreciate if they could post
> it. My notes list the function name as
> void read_load_list(SLLnode *&headptr, char infile[ ])
> We wrote the whole thing out in class and it would help give me some
> direction on assn#2.
>
> Thanks,
> Chris Vaughn
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads