0

using structures, I created a structure named file that point to the next file, i successfully managed to create files and display them but i have not been able to write a function that deletes a specific file with a certain name from the linkage ,the headfile is a file pointer pointing to all files.

struct file
    {   
    string filename;
    file *nextfile;
    };

typedef file *fileptr;   

void deletespecific_file(fileptr &headfile)
    { 
        while (headfile != NULL)
            {
            if(headfile->filename=="filea")
                {
                fileptr temp = headfile;
                delete temp;    
                }
            headfile = headfile -> nextfile;
            }
    }
Max
  • 1
  • 1

0 Answers0