ファイル名=  exercise/chapter21/pass21-2.c
#include 

#include

typedef struct {
char title[100];
char author[100];
int year;
int price;
_Bool ebook;
} book ;

#define SIZE 3

int main(void)
{
FILE *in = fopen("../pass21-1/data.csv", "r");
FILE *out = fopen("book.dat", "w");
if(in==NULL || out==NULL){
fprintf(stderr, "★ファイルを開けません");
exit(EXIT_FAILURE);
}

book bk;
for(int i=0; i fscanf(in, "%[^,],%[^,],%d,%d,%d,", bk.title,bk.author, &bk.year, &bk.price, &bk.ebook );
fwrite(&bk, sizeof(book), 1, out);
//printf("%s %s %d %d %d\n", bk.title, bk.author, bk.year, bk.price, bk.ebook);
}

fclose(in);
fclose(out);
return 0;
}