doubt in cstring..
-
hi i have a basic doubt in cstring.. i have like this: CString test = hello; #define abc L"hello" if (test.find(CString(abc)) == 0) ------ ----- But this if condition is failing...May i know the reason? how to make it to pass??? Can anyone enlighten me about this issue? Thanks, rakesh.
-
hi i have a basic doubt in cstring.. i have like this: CString test = hello; #define abc L"hello" if (test.find(CString(abc)) == 0) ------ ----- But this if condition is failing...May i know the reason? how to make it to pass??? Can anyone enlighten me about this issue? Thanks, rakesh.
Rakesh5 wrote:
CString test = hello;
What is hello? Is it a string literal or an undeclared variable?
Rakesh5 wrote:
if (test.find(CString(abc)) == 0)
find()
is not a member ofCString
. Perhaps you meantFind()
. Why the extraneousCString
construct? All that aside, your code snippet works for me."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Rakesh5 wrote:
CString test = hello;
What is hello? Is it a string literal or an undeclared variable?
Rakesh5 wrote:
if (test.find(CString(abc)) == 0)
find()
is not a member ofCString
. Perhaps you meantFind()
. Why the extraneousCString
construct? All that aside, your code snippet works for me."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Hi David, hello is just a string literal (for example purpose..) and I meant Find only... my doubt is : CString str(test); CString str1 = L"test"; Are str and str1 same?? if not, how to make it same?? thanks, rakesh.
Rakesh5 wrote:
Are str and str1 same??
No, they are two separate objects. How would that differ from:
int x = 5;
int y = 5;Are
x
andy
the same?Rakesh5 wrote:
if not, how to make it same??
You can't, but you can make them contain the same value.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Rakesh5 wrote:
Are str and str1 same??
No, they are two separate objects. How would that differ from:
int x = 5;
int y = 5;Are
x
andy
the same?Rakesh5 wrote:
if not, how to make it same??
You can't, but you can make them contain the same value.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Hi David, i think am not communicating properly.. see, my code has like this: CString str = "hello"; #define test L"hello"; if(str.Find(CString(test)) == 0) { -------- ------ } but its not passing this "if" statement.. my doubt is both are having hello only.. but y "if" condition is failing?? Thanks, rakesh
-
Hi David, i think am not communicating properly.. see, my code has like this: CString str = "hello"; #define test L"hello"; if(str.Find(CString(test)) == 0) { -------- ------ } but its not passing this "if" statement.. my doubt is both are having hello only.. but y "if" condition is failing?? Thanks, rakesh
Rakesh5 wrote:
but its not passing this "if" statement..
Have you stepped into it using the debugger, or are you just looking at the ----- statements to know if the code is correct?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
hi i have a basic doubt in cstring.. i have like this: CString test = hello; #define abc L"hello" if (test.find(CString(abc)) == 0) ------ ----- But this if condition is failing...May i know the reason? how to make it to pass??? Can anyone enlighten me about this issue? Thanks, rakesh.
-
Hi David, i think am not communicating properly.. see, my code has like this: CString str = "hello"; #define test L"hello"; if(str.Find(CString(test)) == 0) { -------- ------ } but its not passing this "if" statement.. my doubt is both are having hello only.. but y "if" condition is failing?? Thanks, rakesh