Im just trying to read a file to see if i did the code correctly but I keep getting this error. Any help is appreciated.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct Node
{
char name[15];
char title[15];
int year;
struct Node *next;
struct Node *prev;
};
typedef struct Node* Box;
Box build_node(FILE *inputp);
int main()
{
Box head=NULL,temp;
FILE *inputp, *outputp;
inputp = fopen("CD_input.txt", "r");
outputp=fopen("output.txt", "w");
head=build_node(inputp);
printf( "%s, %s, %d \n", head->name, head->title, head->year); /*just a test for the line#1. Delete if it works*/
return 0;
}
Box build_node(FILE *inputp)
{
Box temp=NULL;
temp=(Box)malloc(sizeof(struct Node));
fscanf(inputp, "%s", &temp->name);
fscanf(inputp, "%s", &temp->title);
fscanf(inputp, " %d", &temp->year);
temp->next=NULL;
temp->prev=NULL;
return temp;
}