Morning,

Maybe you'll find i'm too lazy :o but I was wondering if there's a better way (i mean API solution) than "Repne scasb" to parse a string.

Here's what is doing my program:

I'm currently writing a program that keeps information about some files. Because i don't want to "pollute" my registry, i'm doing it with an INI file. Here's my INI file:




[SECTION1]
NumberOfKey=3
KEY1=D:\Program Files\Programmation\RadASM\Masm\Projects\Item\TODO.txt
KEY2=D:\Program Files\Programmation\RadASM\Masm\Projects\Item\createinifile.asm
KEY3=D:\Program Files\Programmation\RadASM\Masm\Projects\Item\writeinifile.asm



After Calling "GetPrivateProfileSection" my buffer looks like this:




0040370C NOK=3.KEY1=D:\Program Files\Programmation\RadASM\Masm\Projects\I
0040374C tem\TODO.txt.KEY2=D:\Program Files\Programmation\RadASM\Masm\Pro
0040378C jects\Item\createinifile.asm.KEY3=D:\Program Files\Programmation
004037CC \RadASM\Masm\Projects\Item\writeinifile.asm.



Here's the point: I want to be rid of "KEY1=" and so on (KEY2= ; KEY3= ...), and just retrieve the file path. I'm able to do it with "pure asm" with "Repne scasb" and some other instructions, but is there another way to do it with APIs ?

Thank you very much.

Regards, Neitsa.
Posted on 2003-12-19 07:25:17 by Neitsa
The UCR Standard Library for 80x86 Assembly Language Programmers and the HLA Standard Library (http://webster.cs.ucr.edu) have several routines you could use for this purpose. The str.tokenize2 (HLA) routine, for example, can break up you strings by using "=" as a string delimiter. HLA's pattern matching library would also provide facilities for parsing your strings.
Cheers,
Randy Hyde
Posted on 2003-12-19 10:53:57 by rhyde
Thank you very much Randall,

I'll study it !

The question was just a matter of "knowledge" because I've implemented some Asm instructions that done the job well.

P.S: Randall, you've certainly heard it many times, but AOA is a great book !
Posted on 2003-12-19 11:22:09 by Neitsa
Hi. :)
If the key names are known (or can be easily calculated, like "KEY1", "KEY2", etc...) you could get them using GetPrivateProfileString. It saves you the trouble of having to work out by yourself how to parse the INI section, and it won't cost you anything in terms of performance since the INI file is surely going to be cached.
Posted on 2003-12-20 16:10:00 by QvasiModo