I want to replace lstrlen with following code :
char _szErrorMessage[1024] ;
LPSTR _lpszStart, _lpszError ;
_lpszError = _lpszStart = _szError ;
while(*_lpszStart++) ;
_lpszStart = _lpszStart - _lpszError ;
I get the following error:
Quoteerror #2168: Operands of '=' have incompatible types 'char *' and 'long long int'.
Why?Could someone help me?
Quote from: Grincheux on December 11, 2021, 02:19:29 PM
I want to replace lstrlen with following code :
char _szErrorMessage[1024] ;
LPSTR _lpszStart, _lpszError ;
_lpszError = _lpszStart = _szError ;
while(*_lpszStart++) ;
_lpszStart = _lpszStart - _lpszError ;
I get the following error:
Quoteerror #2168: Operands of '=' have incompatible types 'char *' and 'long long int'.
Why?
Could someone help me?
What you are trying to do?
What is _lpszError?
The error is due to the fact that the difference between 2 pointers is an integer, that you are trying to assign back to _lpszStart that is a pointer to char.
I am counting the difference between the start of the string and the place where the pointer finds '\0'
But you are right. I looked at the operation and not where I stored the result.
Thank You Frankie