The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: linuxuser on May 04, 2007, 01:55:50 PM

Title: Listview read from file and save to file procedure
Post by: linuxuser on May 04, 2007, 01:55:50 PM
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?
Title: Re: Listview read from file and save to file procedure
Post by: evlncrn8 on May 04, 2007, 02:39:16 PM
paste some code then, maybe someone will help.
Title: Re: Listview read from file and save to file procedure
Post by: 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
Title: Re: Listview read from file and save to file procedure
Post by: linuxuser on May 05, 2007, 05:31:12 PM
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?
Title: Re: Listview read from file and save to file procedure
Post by: donkey on May 14, 2007, 03:22:51 PM
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
Title: Re: Listview read from file and save to file procedure
Post by: linuxuser on May 14, 2007, 03:30:51 PM
Thank you but where can i find this example?
Title: Re: Listview read from file and save to file procedure
Post by: donkey on May 14, 2007, 04:26:12 PM
http://www.masm32.com/board/index.php?topic=3803.0
Title: Re: Listview read from file and save to file procedure
Post by: linuxuser on May 14, 2007, 04:30:50 PM
Thank you! :U