Up for a challenge? Advanced Programming GCC/Database/Makefile

I am programming a database (100 Records) half of the database needs to be random. The other half can be modified by the user. I also need to be able to sort and search through the records. (Those functions I will develop as soon as I can figure out how to fix my problem).

On a basic level the database works (almost).

The structure of the database is as follows:

struct accountdata{
unsigned int RecordId; unsigned int LastUpdate;
char LName[MAXFNAME]; char FName[MAXLNAME];
double Balance;
int filled;
struct accountdata *next;};

struct accountdata *first, *current, *p_new, *last;

Yes, I am including linked lists.... and a makefile.

I am scanning directly into the structure from a binary file, using the fread function, but cannot seem to get the information out of the file.

if(datafile){
first=(struct accountdata *)malloc(sizeof(struct accountdata));
current=first;
while(1){
p_new=(struct accountdata *)malloc(sizeof(struct accountdata
));
fread(current,sizeof(struct accountdata),1,datafile);
current->filled = 0;
if(current->next==NULL)break;
current->next=p_new;
current=p_new;
}
fclose(datafile);
}

If you feel up for a challenge and need to see my full project, please give me a shout.

Thanks in advance for all help rendered.

psyberbob
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories