i have a simple program with a listview and a button. when you press the button the listview should be filled with info from a file.

im able to get it to work with global allocation of memory but not with memory mapping of the file. im just testing on a small file but my intentions are to use is for large files.
Posted on 2002-01-11 23:00:02 by smurf
you map with FILE_MAP_READ, and thus the mapped file is read-only :).
Remember that when using memory mapped files, changes (if you
also map for write) go directly to the file... that's what makes mmap'd
files so convenient.

One way to handle this would be to keep track of line starts, and
when you get a ,13,10 sequence, copy the line to a temporary buffer,
add NUL, and add to the listview.
Posted on 2002-01-12 02:36:04 by f0dder
thanks f0dder. to get it to work i just changed the FILE_MAP_READ to a read and write mode. problem is that it my file is being writen to for some reason i dont understand. after i exit and check my text file all the text is moved onto a single line with no end of line in sight.
Posted on 2002-01-12 09:52:23 by smurf
smurf... file mapping doesn't just read the file into memory. When
you read from the file, you cause a page fault, which is handled by
windows, which reads the file from disk (through the cache system,
so the stuff is only (re)read if it's not in memory, or has changed).

Same goes for write, although it sends a write request to the
caching system.
Posted on 2002-01-12 10:01:06 by f0dder