I cant get it to display the contents in assign6 file. Its supposed to order whats already in the file and save it back out to disk.

In the file it says

Smith, Bob
233-444-5555
43
Manager




PHP Code:
code:--------------------------------------------------------------------------------
#include "stdafx.h"
#include <fstream>
#include <iostream>

using namespace std;


struct record
{
    
char name[50];
    
char ssn[12];
    
char age[4];
    
char occupation[50];
    
struct record *next/* pointer to next entry */
    
struct record *prior/* pointer to previous record */
  
};


struct record *start;  /* pointer to first entry in list */
struct record *last;  /* pointer to last entry */
struct record *find(char *);

void enter(void), search(void), save(void);
void load(void), list(void);
void dls_store(struct record *istruct record **start,
               
struct record **last);

void inputs(char *, char *, int), display(struct record *);




int menu();


class 
LL 
{
private:
record *head;
record *tail;
public:
LL();
int insert(record data);
record *search(char[]);
int delete_item(char[]);

};
LL::LL ( )
{
head NULL;
tail NULL;
}


int main(int argccharargv[])
{
    
load();
     
start last NULL;  /* initialize start and end pointers */
    
int temp =0;

do {    
    
    
temp menu ();
    switch(
temp)
    {

      case 
1: list();
        break;
     
      case 
4save(); 
        break;

      default:
          
cout << temp << " is invalid!" << endl;
          }
} while (
temp != 4);

return 
0;

}





/* Create a doubly linked list in sorted order. */
void dls_store(
  
struct record *i,   /* new element */
  
struct record **start/* first element in list */
  
struct record **last /* last element in list */
)
{
  
struct record *old, *p;

  if(*
last==NULL) {  /* first element in list */
    
i->next NULL;
    
i->prior NULL;
    *
last i;
    *
start i;
    return;
  }
  
= *start/* start at top of list */

  
old NULL;
  while(
p) {
    if(
strcmp(p->namei->name)<0){
      
old p;
      
p->next;
    }
    else {
      if(
p->prior) {
        
p->prior->next i;
        
i->next p;
        
i->prior p->prior;
        
p->prior i;
        return;
      }
      
i->next p/* new first element */
      
i->prior NULL;
      
p->prior i;
      *
start i;
      return;
    }
  }
  
old->next i/* put on end */
  
i->next NULL;
  
i->prior old;
  *
last i;
}


/* Display the entire list. */
void list(void)
{
  
struct record *info;

  
info start;
  while(
info) {
    
display(info);
    
info info->next;  /* get next address */
  
}
  
printf("\n\n");
}

/* This function actually prints the fields in each address. */
void display(struct record *info)
{
    
printf("%s\n"info->name);
    
printf("%s\n"info->ssn);
    
printf("%s\n"info->age);
    
printf("%s\n"info->occupation);
    
printf("\n\n");
}

/* Load the address file. */
void load()
{
  
struct record *info;
  
FILE *fp;

  
fp fopen("assign6""rb");
  if(!
fp) {
    
printf("Cannot open file.\n");
    exit(
1);
  }

  
/* free any previously allocated memory */
  
while(start) {
    
info start->next;
    
free(info);
    
start info;
  }

  
/* reset top and bottom pointers */
  
start last NULL;

  
printf("\nLoading File\n");
  while(!
feof(fp)) {
    
info = (struct record *) malloc(sizeof(struct record));
    if(!
info) {
      
printf("Out of Memory");
      return;
    }
    if(
!= fread(infosizeof(struct record), 1fp)) break;
    
dls_store(info, &start, &last);
  }
  
fclose(fp);
}


/* Save the file to disk. */
void save(void)
{
  
struct record *info;

  
FILE *fp;

  
fp fopen("assign6""wb");
  if(!
fp) {
    
printf("Cannot open file.\n");
    exit(
1);
  }
  
printf("\nSaving File\n");

  
info start;
  while(
info) {
    
fwrite(infosizeof(struct record), 1fp);
    
info info->next;  /* get next address */
  
}
  
fclose(fp);
}


int menu ()
{
    
int item;
    
// display menu and return output

    
cout << "===============================" << endl;
    
cout << "      Please Select An Option            " << endl << endl;
    
cout << " 1. Display a record" << endl;
    
cout << " 2. Add a record" << endl;
    
cout << " 3. delete a record" << endl;
    
cout << " 4. Exit" << endl;
    
    
    
cin >> item;
    
cin.ignore ();

    
// return item
    
return item;
}
-------------------------------------------------------------------------------- 
I think i might need to put this part
void dls_store(

in the class somehow?