CPP read-write input-output problem

topic description

CPP read and write problems

sources of topics and their own ideas

I don"t know how to use the linked list to call the read () function, where head is the header pointer

related codes

/ / Please paste the code text below (do not replace the code with pictures)

infile.open ("student.txt", ios::in);
infile.read ((char *) head,sizeof (student)); while (infile)

{        

cout < < head- > num < < "t"; cout < < head- > name < < "t"; cout < < head- > score < < endl; head=head- > next; infile.read ((char *) head,sizeof (student));}
infile.close ();
}

what result do you expect? What is the error message actually seen?

CPP
Apr.01,2021

this is such a mess. Does the head pointer save the data? The input parameter of head should be changed to const char . Infile is a fstream stream, right? Read (unsigned char buf,int num);
t also has the wrong number

Menu