LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2014, 11:15 AM   #1
endhx
LQ Newbie
 
Registered: Apr 2013
Posts: 25

Rep: Reputation: Disabled
[Unnecessary]


edit: Nevermind, .

Last edited by endhx; 07-21-2014 at 10:30 PM.
 
Old 07-18-2014, 01:32 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,137

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
The problem is that in C++ a vector is a struct which contains a pointer to dynamically allocated data. You would have to do some non-portable hack to point the pointer to your mmap data. Any time you make a change to the data it may cause it to be moved or reallocated, which would break your mmap.
 
Old 07-19-2014, 01:30 AM   #3
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
you can of course copy the content into a vector
but I am not sure if (and why) you want to do this
do you just want to read or also write to the file?

you can also have a look at boost iostream, it deals also with mmaped files
http://www.boost.org/doc/libs/1_55_0...pped_file.html
 
Old 07-20-2014, 05:26 PM   #4
endhx
LQ Newbie
 
Registered: Apr 2013
Posts: 25

Original Poster
Rep: Reputation: Disabled
Well, a vector or a string. I'm trying to do manipulation and using char *'s is giving me problems. I'm hoping that moving to another format might clean things up a bit.
 
Old 07-21-2014, 12:43 AM   #5
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
what's the problem with char* ?
what do you think would be different with a vector?
what with a string,(beside that std::string s("äöå") is possibe utf8 in your environment)
automatically growth of the size? beside this there is basically no difference to a 'fix size array'

it would possible be more useful to describe your problem
 
Old 07-22-2014, 12:32 AM   #6
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
@endhx
instead of changing the subject and removing the content of you OP
just mark the thread as solved
I think this is better than changing the history (and helps to get not ignored in future)
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] void pointer casting of vector within a vector C++ gothrog Programming 6 12-16-2012 11:06 PM
[SOLVED] vector,matrices drawing software. some thing like android(Visual Vector Math) PoleStar Linux - Newbie 3 11-02-2012 10:45 PM
LXer: Tropic of Vector – a blog devoted to Vector Linux Light, plus the Vector Linux LXer Syndicated Linux News 0 09-17-2009 01:30 PM
LXer: Vector Linux 5.9-Pseudo64-0.1 -- Finally, 64-bit Vector LXer Syndicated Linux News 0 09-12-2007 01:20 PM
can i modify int 80 vector to a user-defined vector qqrilxk Linux - Security 1 03-03-2005 08:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration