views:

39

answers:

1

So this is a homework assignment, and it's kind of a doozy so i'll try to TL;DR it. Basically Im making a Shared memory database with 5 files (load,query,clean,print,change) Load loads the database from a file. (students have a first name/last name/address/telephone number) Query lets someone "search" for a specific student print....well prints the contents of the shared memory and change lets people change the database and clean gets rid of the sephamores and saves the contents of the shared memory to a file.

Now the professor gave us a bunch of code, and for the most part I understand it. His was seperated in 3 files. (a change,create and header file) My main question is, how would I go about storing multiple "objects" into shared memory.

Like he keeps the student data in a struct naturally, and for his "example" he seems to load it by using a struct * ptr. But how would I go about loading multiple students?

I could post the source here, but it's 4 different files and quite long.

+2  A: 

Use an array of structs, instead of a single struct?

Nathon
This. Unless you need it to scale dynamically.
mootinator
Ya I suppose that makes sense! i didn't know if that worked with shared memory but I guess why not.
Mercfh