The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Rainstorm on November 08, 2006, 07:57:54 PM

Title: how to count a string without aa 0 terminator
Post by: Rainstorm on November 08, 2006, 07:57:54 PM
Hi,..

How do i count a string without a 0 terminator
like for exaample with the following decleration.

word1 db "String"

thanks...
Title: Re: how to count a string without aa 0 terminator
Post by: EddieB on November 08, 2006, 08:02:32 PM
If you have it declared as so, can you not just use the length? ( '6' )



Title: Re: how to count a string without aa 0 terminator
Post by: Tedd on November 08, 2006, 08:07:09 PM
"sizeof word1" will give you its length in the code.
If you do null-terminate it, but want the length not including the zero, then you can do "(sizeof word1)-1"
Title: Re: how to count a string without aa 0 terminator
Post by: Rainstorm on November 08, 2006, 08:30:49 PM
Thankyou Ted.

Rainstorm

[edit]
eddieB wrote
QuoteIf you have it declared as so, can you not just use the length? ( '6'
yes, meant the length/(no of chars)....but i wanted to know
how i could get the value  in the code.