LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   [Unnecessary] (https://www.linuxquestions.org/questions/programming-9/%5Bunnecessary%5D-4175511521/)

endhx 07-18-2014 11:15 AM

[Unnecessary]
 
edit: Nevermind, .

smallpond 07-18-2014 01:32 PM

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.

a4z 07-19-2014 01:30 AM

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

endhx 07-20-2014 05:26 PM

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.

a4z 07-21-2014 12:43 AM

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

a4z 07-22-2014 12:32 AM

@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)


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