ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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?
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.
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
@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)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.