Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Segementation Problem while accessing contents from Memory Mapped File

Reply
Thread Tools

Segementation Problem while accessing contents from Memory Mapped File

 
 
nkrisraj@gmail.com
Guest
Posts: n/a
 
      01-10-2006
Hi,

I have a following structure:
typedef struct
{
RateData rdr;
int RateID;
char RateBalance;

} RateInfo;

typedef struct
{
DayRates *dr;
WeekRates *wr;

} RateData;

First I will create the memoefy for the DayRates, WeekRates structures
inside the RateInfo structure variable. After that Iam going to copy
the contents into DayRates, WeekRatesstructures. Once the all the
structure members inside RateInfo structure variable are initialized, I
will add that node to a AVL tree. This way, Iam going to create an AVL
tree by adding RateInfo nodes to it. Once the total tree is contructed,
I will store this tree as file (rateinfo.map) on the disk.

In my next programming component, Iam going to load this file
(rateinfo.map) into memory using mmap() function call. Once I load the
file into memory using mmap(), Iam able to access the RateID and
RateBalance members of the RateInfo. But, Iam not able to access the
DayRates, and WeekRates structure contents. When I try to access the
members of DayRates , and WeekRates structures, my program is showing
segmentation fault and Iam getting the core dump.

Even though I allocated memory for DayRates , and WeekRates structures
inside RateInfo node while creating the tree, why Iam not able to
access contents of DayRates , and WeekRates structures when I mmap()
file into memory?

Any pointers would be a great help.

Thanks,
-Nikhil

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
memory mapped tar file contents Chris Brooks Python 1 11-13-2008 07:31 AM
segementation fault priyanka C Programming 7 07-18-2006 11:31 PM
segementation fault didier2309 C Programming 23 05-11-2006 12:38 AM
Segementation Problem while accessing contents from Memory Mapped File nkrisraj@gmail.com C Programming 3 01-10-2006 08:00 PM
Core dump while accessing contents from Memory Mapped File nkrisraj@gmail.com C Programming 8 01-10-2006 07:58 PM



Advertisments