Creating a memory mapped file

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2008
Posts: 1
Reputation: KDan is an unknown quantity at this point 
Solved Threads: 0
KDan KDan is offline Offline
Newbie Poster

Creating a memory mapped file

 
0
  #1
Nov 15th, 2008
Hi everyone!!

First of all am quite new to cpp especially under linux.

I am currently working on a small project under Linux and am having to deal with large number of data(larger than 1 GB). numerous number of operation is to be done with these data. for example: sorting, searching, comparing ... etc. so in order to perform all these operations it is important that these data are in the memory...

in order to deal with such a large amount of data am thinking of using a memory mapped file..
can anyone help me or guide me in the steps of creating a memory mapped file?

Please help ..
Thanking in advance
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,089
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Solved Threads: 164
vijayan121 vijayan121 is offline Offline
Veteran Poster

Re: Creating a memory mapped file

 
0
  #2
Nov 16th, 2008
> man mmap <Enter>
at the command prompt on your system. it should give you all the information that you require.you would see something like this: http://www.freebsd.org/cgi/man.cgi?q...le&format=html
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 15
Reputation: james_zheng is an unknown quantity at this point 
Solved Threads: 0
james_zheng james_zheng is offline Offline
Newbie Poster

Re: Creating a memory mapped file

 
0
  #3
Nov 16th, 2008
hi KDan !
the following steps tell u how to create a memory mapped file:
1. use 'open' function to get a file description;
2. create a memory maped file using 'mmap' function, which returns a pointer to the address of the memory;
3. 'munmap' function close a memory maped file;
4. 'close' to close the file;
btw:why not use database operation instead?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC