Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void bookInfo(char *path, int ranking[MAX_BOOKS], int category[MAX_BOOKS], char author[MAX_BOOKS][BIG], char publisher[MAX_BOOKS][BIG], int price[MAX_BOOKS], char description[MAX_BOOKS][BIG])
- {
- {
- int i;
- char buffer[BIG];
- FILE *bookFile;
- bookFile = fopen(path, "r");
- if(bookFile == NULL)
- {
- printf("Unable to open file!\n");
- system("exit");
- }
- for(i=0; !feof( bookFile ); i++)
- {
- fgets( buffer, sizeof(buffer), bookFile);
- /* /// This is so frustrating!
- 4 1,ZERO DAY, by David Baldacci (Grand Central Publishing, $27.99) A military investigator uncovers a conspiracy.
- (ranking, category, title, author, publisher, price, description)(int int string string int string)
- */
- sscanf(buffer, "%i %i%[^,],%[^,], by %[^(](%[^,], $%d%[^)]) %s", &ranking[i], &category[i], author[i], publisher[i], &price[i], description[i]);
- printf("%p %p %p %p %p %p\n", ranking[i], category[i], author[i], publisher[i], price[i], description[i]);
- printf("%d %d %s %s %d %s\n", ranking[i], category[i], author[i], publisher[i], price[i], description[i]);
- }
- fclose(bookFile);
- }
- }
Add Comment
Please, Sign In to add comment