The difference between lstrlen and strlen and sizeof in c++

strlen() is the byte length of the returned string, and   
lstrlen() is the character length of the returned string.   
That is to say, the result of the second function may be the same as the first function, if the character units in the string are all single-byte.   
    
Generally speaking, the main difference is between ascii characters, unicode or utf.
ASCII encoding means that one character occupies one byte, and Unicode means that one character occupies two bytes. To find the length of these two kinds of strings, two functions are used separately.
lstrlen(), strlen() are used to manipulate strings or Character array, lstrlen(), strlen() are the string length obtained after the program is run. 
sizeof() can operate on any kind of line.   
sizeof() is calculated by the compiler  

lstrlen used for unicode   
strlen used for ansi   
sizeof compiler allocates memory size

Guess you like

Origin blog.csdn.net/mid_Faker/article/details/112608002