News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Listview read from file and save to file procedure

Started by linuxuser, May 04, 2007, 01:55:50 PM

Previous topic - Next topic

linuxuser

Hello to everyone,
I would like to build a phone book application with a listview and some columns like name, phone ...., i would like to save to a txt file, as delimiter i would like this "|", and after every row i want a new line in the txt file , and the file must be loaded on every program start.
I have written an application like this in vb.net express, and now i would like to build the same application in winasm studio with masm32 code.
The only problem is the file loading nad saving algo.
Would anyone help me please?

evlncrn8

paste some code then, maybe someone will help.

donkey

Reading a file line by line is pretty slow, you should memory map the file then scan it using string functions or a loop for CR/LF, that will indicate the end of a given line. At that point the parser is fairly straight forward. If you are only using the single delimiter type it is just as easy to scan the memory mapped file for the delimiter OR CR/LF and plug the values into your listview "on the fly", this will make load times quite a bit faster. When you're done the with file close the mapping object and the file and you're done.

Donkey
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

linuxuser

#3
Quote from: donkey on May 05, 2007, 12:18:07 AM
Reading a file line by line is pretty slow, you should memory map the file then scan it using string functions or a loop for CR/LF, that will indicate the end of a given line. At that point the parser is fairly straight forward. If you are only using the single delimiter type it is just as easy to scan the memory mapped file for the delimiter OR CR/LF and plug the values into your listview "on the fly", this will make load times quite a bit faster. When you're done the with file close the mapping object and the file and you're done.

Donkey

Thank you for answering.
Can you show me an example?

donkey

There is an example of this in WinExplorer, just look at the way the Hex Viewer works, it uses a method close to this one.

Donkey
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

linuxuser


donkey

"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable