Home » U++ Library support » LineEdit, EditFields, DocEdit » Memory Mapping LineEdit Data
Re: Memory Mapping LineEdit Data [message #58193 is a reply to message #58180] |
Fri, 18 March 2022 18:37  |
 |
mirek
Messages: 14257 Registered: November 2005
|
Ultimate Member |
|
|
syntax_ wrote on Wed, 09 March 2022 05:13Hello UppWorld! Noob here.
I have a simple parent control that manages a LineEdit, MemStream, and my own class MemoryMappedFile (I didn't find FileMapping until later since it is not under Documentation tab, and anyway it appears to be readonly?).
When I load a file I can successfully MemStream::Create, init my MemoryMappedFile, and LineEdit::Load(myMemStream), and there is a successful display of the file's contents.
My problems are:
A) External edits to the file are not displayed in the LineEdit, even with a forced Refresh(), unless I destroy\reopen the file. I'm guessing I could look at the file descriptor's modify times and do this through user interaction notifications, but feels wrong.
B) Edits to the LineEdit control do not appear "linked" in any way to the actual mmapped data, i.e. when I msync (successfully according to checked return code) no data is written to the file.
Is there a better way to go about this? I am mmaping with PROT_READ|PROT_WRITE and MAP_SHARED, I just can't seem to sync up the control to the data..
Thank you.
I think that is misunderstading. Load really loads file content into MemoryMappedFile into "internal data" of LineEdit. If you want these data to stored, Save can save them to the Stream.
AFAIK it is practically impossible to directly edit files on disk. The problem is that the moment you insert something, you would need to copy all the physical data in the stream and that would be too slow. And it would wear out SSD disks pretty fast.
|
|
|
Goto Forum:
Current Time: Sat May 10 10:05:15 CEST 2025
Total time taken to generate the page: 0.03979 seconds
|