I am trying to read - write a txt file that has several info in different lines. It is in the form of:
Number-LicencePlate NumberOfSeats
Name number phonenumber
Name number phonenumber
Name number phonenumber
To read the first line it is pretty easy using fscanf But how can I read the rest of it using fscanf to obtain 3 different variables (Name,Number,phone)?
Write to this file in the same form comes at a later stage but will try to work it out..
FILE *bus;
bus = fopen ("bus.txt","r");
if (bus == NULL)
{
printf("Error Opening File, check if file bus.txt is present");
exit(1);
}
fscanf(bus,"%s %d",platenr, &numberofseats);
printf("Bus Licence plate Nr is: %s and number of seats is: %d", platenr, numberofseats);