Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


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

Rep: Reputation: Disabled

edit: Nevermind, .

Last edited by endhx; 07-21-2014 at 10:30 PM.
Old 07-18-2014, 01:32 PM   #2
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 1,979

Rep: Reputation: 507Reputation: 507Reputation: 507Reputation: 507Reputation: 507Reputation: 507
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
Registered: Feb 2009
Posts: 786

Rep: Reputation: 297Reputation: 297Reputation: 297
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
Old 07-20-2014, 05:26 PM   #4
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
Registered: Feb 2009
Posts: 786

Rep: Reputation: 297Reputation: 297Reputation: 297
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
Registered: Feb 2009
Posts: 786

Rep: Reputation: 297Reputation: 297Reputation: 297
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.


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

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

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