There are three ways to deal with the length of strings that i know of.

1...Mark it lenghtof Strings (to be same size as string)

2...Or Put the exact number of charaters in place of Lenghtof.

3...Or use StrLen from masm32.LIB or another optimized version.

If i just let Masm do it, is it simply going to use its OWN (out dated) StrLen anyway.

Is this true.

Would a app come out better by using an optimized StrLen that can beat raw Masm even if you use an exact number.

Do anyone know the working of Masm pertaining to this.

I need to know this because I in the mood for ripping and tearing AGAIN... Posted on 2002-03-21 12:43:06 by cmax
I am not sure but I think lengthof will only give you the lenghth of a constant string so it is the same as putting in the exact number, it calculates the length and assembles in the exact number. So If your string is going to always be the same length use lengthof but if it might change then use strlen.
Posted on 2002-03-21 12:53:07 by Quantum
LENGTHOF is perfect if your string is already embedded on your code. LENGTHOF is basically like strlen but only works at assembling time (compilation time)

str DB "Hello Cruel World", 0
mov eax, LENGTHOF str ;This is much better
invoke strlen, OFFSET str ;than this
If you have an indeterminate string like an input from a user, then you have to use strlen, LENGTHOF doesn't work at runtime.
Posted on 2002-03-21 12:58:59 by stryker
I am sure glad i asked this question. Now i know that StrLen is more or less for special operations. I can now cut out about half of my mis-using and abusing of it...

Thanks Again
Posted on 2002-03-21 17:12:34 by cmax