#Adding Data from binary file to a doubly linked list

8 messages · Page 1 of 1 (latest)

prime dewBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

spiral notch
#

How do i continue and I add the students in the list?
What do you mean by students? This is the first time you mention it

azure verge
#

'typedef struct nodeR* node;
typedef struct listR* list;

typedef struct{
char name[MAXSTRING];
unsigned long id;
}student;

struct nodeR{
student data;
node next;
node previous;
};

struct listR{
node head;
node tail;
};'

violet lodge
#

!f

prime dewBOT
#

`Result load(```cpp
char *FileName, list l) {
FILE
fp = fopen(FileName, "rb");
if (fp == NULL) { // If file does not exist create the file
fp = fopen(FileName, "wb");
if (fp == NULL) { // If there was an error making file
return F_WRITE_ERR;
}
}

*l = malloc(sizeof(struct listR));
if (*l == NULL) {
fclose(FileName);
return UNKNOWN_ERR;
}

fclose(fp);
return NO_ERR;
}
`

Result is just this : 

`typedef enum {
NO_ERR,
MALLOC_ERR,
F_READ_ERR,
F_WRITE_ERR,
NON_INIT_LIST,
SYNTAX_ERR,
UNKNOWN_ERR
} Result;




How do i continue and I add the students in the list?
Lampros
prime dewBOT
#

@azure verge

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

azure verge
#

!solved