910 LAB Parsing food data Given a text file containing the availability of food items write a

9.10 LAB: Parsing food data Given a text file containing the availability of food items, write a program that reads the information from the text file and outputs the available food items. The program first reads the name of the text file from the user. The program then reads the text file, stores the information into the four string arrays predefined in the program, and outputs the available food items in the following format: name (category) - description Assume the text file contains the category, name, description, and availability of at least one food item, separated by a tab character ('t'). Hints: Use the fgets() function to read each line of the input text file. When extracting texts between the tab characters, copy the texts character-by-character until a tab character is reached. A string always ends with a null character (10). Ex: If the input of the program is: food.txt

9.10 LAB: Parsing food data
Given a text file containing the availability of food items, write a program that reads the information from the text file and outputs the available food items.

The program first reads the name of the text file from the user. The program then reads the text file, stores the information into the four string arrays predefined in the program, and outputs the available food items in the following format: name (category) – description

Assume the text file contains the category, name, description, and availability of at least one food item, separated by a tab character (‘\t’).

Hints: Use the fgets() function to read each line of the input text file. When extracting texts between the tab characters, copy the texts character-by-character until a tab character is reached. A string always ends with a null character (10).

Ex: If the input of the program is: food.txt


 
Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.

 
Instant
Download

Student review: (3 ratings) 3 out of 3 people found this solution helpful.