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, WeekRatesstruct ures. 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 2358
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.progr ammer.
--
Keith Thompson (The_Other_Keit h) 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.or g>,
Keith Thompson <ks***@mib.or g> 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 read the data from the in memory array or from the
database itself if the table is too large to be loaded into memory. (2GB is
usually the limit because the array is indexed by a 32 bit signed integer.
I have never had one of these tables go over...
|
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, or
other controls depending on the particular form. This application is setup
with one MDI parent calling MDI children with the exception of one Modal
form (the report viewer).
When I run the application and run one of the screens that pulls...
|
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 folder on mapped network drive (eg. N:\Storage that
corresponds to \\FS1NS\SharedDir\), I get an error as "Could not find part
of path N:\".
|
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 i/o.In my
understanding it is a system where I/O devices are treated as memory
locations and are addressed using same number of address lines.How an
object placed at a specific location makes a difference to this?Some
body pls clarify?
|
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:
#!/usr/bin/env python
import tarfile
import mmap
|
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
transformations. I essentially want to pull the image out of the gz'ed tar
and into memory so I can work on it (as a file) and later write the changed
contents to somewhere else. But I don't really want to uncompress/untar and
save the file to disk and then...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |