Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What coding is needed to

Status
Not open for further replies.

gazflat33

Technical User
Nov 22, 2002
13
GB
Clear my queue before i read data into it from a file?
It will read in the data correctly except i have an extra bit off info which im sure is there because i havnt cleared the queue first.
Heres my code:

case 'R' : cout << &quot; read in data saved to file \n&quot;;
Plane_save = fopen(&quot;PlaneOrd.txt&quot;,&quot;rb&quot;);
fread(&airplane, sizeof(char),1,Plane_save);
addPlane(q, letter);
while(!feof(Plane_save))
{
addPlane(q,airplane);
fread(&airplane,sizeof(char),1,Plane_save);
}
fclose(Plane_save);
break;
 
Have you looked at fflush() to clear streams:

#include <stdio.h>
int fflush(FILE *stream);

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top