Hi,
I have a following structure:
typedef struct
{
RateData rdr;
int RateID;
char RateBalance;
} RateInfo;
typedef struct
{
DayRates *dr;
WeekRates *wr;
} TimeOfDayRates;
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 3 2324
Please find the correct structure declarations:
typedef struct
{
RateData rdr;
int RateID;
char RateBalance;
} RateInfo;
typedef struct
{
DayRates *dr;
WeekRates *wr;
} RateData; nk******@gmail.com writes:
[snip] 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?
There is no mmap() function in standard C (it's defined by POSIX, a
separate standard). You'll need to ask in a newsgroup for your
system, perhaps comp.unix.programmer.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
In article <ln************@nuthaus.mib.org>,
Keith Thompson <ks***@mib.org> wrote: There is no mmap() function in standard C (it's defined by POSIX, a separate standard).
True, but his real problem was in trying to use a pointer created
in one execution in a different execution. He could have just
read() the same data into a block of memory and tried to use it,
to the same failed effect. mmap() was a red herring in this problem.
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Peter Nolan |
last post by:
Hi All,
I have some software that currently loads database tables into sorted arrays
in memory to be binary searched by processes. (Long story as to why it does
this..)
Each process must either...
|
by: Justin Lazanowski |
last post by:
Cross posting this question on the recommendation of an
I have a .NET application that I am developing in C# I am loading
information in from a dataset, and then pushing the dataset to a grid,...
|
by: Niloday |
last post by:
Hi All,
I am trying to access a mapped network drive from a service that I have
created.
The service needs to create/delete folders/files on a network drive. When I
tried to connect to a...
|
by: nkrisraj |
last post by:
Hi,
I have a following structure:
typedef struct
{
RateData rdr;
int RateID;
char RateBalance;
} RateInfo;
|
by: nkrisraj |
last post by:
Hi,
I have a following structure:
typedef struct
{
RateData rdr;
int RateID;
char RateBalance;
} RateInfo;
|
by: Samshayam |
last post by:
I have come across the application of placement new in memory mapped
i/o in a number of books.I am not able to understand it completely, may
be becaues of my lack of knowledge with memory mapped...
|
by: Dennis |
last post by:
Hi, I have a text file that contents a list of email addresses like
this:
"foo@yahoo.com"
"tom@hotmail.com"
"jerry@gmail.com"
"tommy@apple.com"
I like to
|
by: Chris Brooks |
last post by:
Hi,
I would like to read directly from a tar file into memory so I can
manipulate a file (quickly) and write its changes out to another file. I
thought I could do something like:
...
|
by: Chris Brooks |
last post by:
Jean-Paul Calderone wrote:
Actually, I want the contents of the tar uncompressed and untarred. So, for
example, I might be working with image data that has to go through several...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |