Archived

This topic is now archived and is closed to further replies.

Justaddwater

C++ Reading from a txt file

Recommended Posts

Ok I can write to a file fine, but when trying to read i get stuck can anyone enlighten me as to what im doing wrong?
if (infile.fail()!= true)
{
	while (!(infile.eof()))
	{
		
	
			infile >> FoodID;
	
			if (strcmp(FoodID,"Dairy")==0)
				readdairy();
			if (strcmp(FoodID,"Fruit")==0)
				readfruit();
			if (strcmp(FoodID,"Meat")==0)
				readmeat();
			system ("pause");
			//FoodID[0] = '\0';

			
		
		}
}

		infile.close();
[edited by - justaddwater on March 18, 2004 3:33:30 AM]

Share this post


Link to post
Share on other sites