I need to write a program that can read the relevant information from a file and output the maintenance needs as shown in the sample output on the following slides.
I have completed the code to read from the .txt file as seen in this screen shot:
This is the code I have completed for the above(with an alternate method in comments):
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *cfPtr = fopen("C:\\Users\\David O'Dea\\Desktop\\Test\\MaintenanceSchedule.txt","r");
int line = 0;
char input[255];
while (fgets(input, 255, cfPtr))
{
//line++;
printf("%s", input);
}
printf("\n\nEnd of program\n");
fclose(cfPtr);
return 0;
}
//int main() {
// FILE *cfPtr = fopen("C:\\Users\\David O'Dea\\Desktop\\Test\\MaintenanceSchedule.txt","r");
//C:\\Users\\David O'Dea\\Desktop\\Test\\MaintenanceSchedule.txt
//char c;
//f = fopen("C:\\Users\\David O'Dea\\Desktop\\Test\\MaintenanceSchedule.txt", "rt");
//while ((c = fgetc(f)) != EOF){
// printf("%c", c);
//}
//fclose(f);
//return 0;
//}
I am not sure how to complete the second task of reading in from the .xlsx file so that the result is as below:
.xlsx
file..xlsx
format. .xlsx
is an open format. .xlsx
is an ooxml
format, so it is essentially a zip
formatted compressed file. You can inflate the file and check the releavant section (document.xml
if I remember correctly) and parse the ``.xml` file.