D - [help] property error
- Lewis (29/29) Jan 07 2004 ok, i have the following enumeration:
ok, i have the following enumeration: enum CompareMethod { BinaryCompare = 0, TextCompare = 1 } and the following function for comparing two char[] strings, (AString is an alias for char[]) and it gives me a -no property 'CompareText' for type 'int' compile eror... public int StrComp(AString Value1,AString Value2,CompareMethod Compare) { int len1 = Value1.length; int len2 = Value2.length; int result = 0; try { if (len1 == len2) { if (Compare == CompareMethod.CompareText) { result = memcmp((char*)Value1,(char*)Value2,len1); } else {result = memicmp((char*)Value1,(char*)Value2,len1);} return result; } else { return result; } } catch { return result; } } would somebody be able to posibly tell me what im doing wrong, im thinking im using the enum incorectly, but i dont know how... thanks
Jan 07 2004
Lewis wrote:ok, i have the following enumeration: enum CompareMethod { BinaryCompare = 0, TextCompare = 1 } and the following function for comparing two char[] strings, (AString is an alias for char[]) and it gives me a -no property 'CompareText' for type 'int' compile eror... public int StrComp(AString Value1,AString Value2,CompareMethod Compare) { int len1 = Value1.length; int len2 = Value2.length; int result = 0; try { if (len1 == len2) { if (Compare == CompareMethod.CompareText) { result = memcmp((char*)Value1,(char*)Value2,len1); } else {result = memicmp((char*)Value1,(char*)Value2,len1);} return result; } else { return result; } } catch { return result; } } would somebody be able to posibly tell me what im doing wrong, im thinking im using the enum incorectly, but i dont know how... thankswoops nm, mistyped it :( boy i feel stupid now
Jan 07 2004
Can you bit a bit clearer about what you're trying to achieve and, since you said you made a typo, post again, after having converted tabs to spaces, so we can see your code in its formatted state? :) "Lewis" <dethbomb hotmail.com> wrote in message news:bthpup$2nh6$1 digitaldaemon.com...ok, i have the following enumeration: enum CompareMethod { BinaryCompare = 0, TextCompare = 1 } and the following function for comparing two char[] strings, (AString isanalias for char[]) and it gives me a -no property 'CompareText' for type 'int' compile eror... public int StrComp(AString Value1,AString Value2,CompareMethod Compare) { int len1 = Value1.length; int len2 = Value2.length; int result = 0; try { if (len1 == len2) { if (Compare == CompareMethod.CompareText) { result = memcmp((char*)Value1,(char*)Value2,len1); } else {result = memicmp((char*)Value1,(char*)Value2,len1);} return result; } else { return result; } } catch { return result; } } would somebody be able to posibly tell me what im doing wrong, im thinkingimusing the enum incorectly, but i dont know how... thanks
Jan 07 2004
Matthew wrote:Can you bit a bit clearer about what you're trying to achieve and, since you said you made a typo, post again, after having converted tabs to spaces, so we can see your code in its formatted state? :) "Lewis" <dethbomb hotmail.com> wrote in message news:bthpup$2nh6$1 digitaldaemon.com...*reformatted* //enum of compare methods enum CompareMethod { BinaryCompare = 0, TextCompare = 1 } and the following function for comparing two char[] strings, (AString is an alias for char[]) and it gives me a: -no property 'CompareText' for type 'int' compile eror... public int StrComp(AString Value1, AString Value2, CompareMethod Compare) { int len1 = Value1.length; int len2 = Value2.length; int result = 0; //assume failure try { if (len1 == len2) { if (Compare == CompareMethod.CompareText) //check compare method desired { result = memcmp((char*)Value1,(char*)Value2,len1); } else {result = memicmp((char*)Value1,(char*)Value2,len1);} return result; } else { return result; } //failed, unequal length } catch { return result; } //error }after looking at it after i posted i seen the error this line > Compare == CompareMethod.CompareText should be > Compare == CompareMethod.TextCompare basically its a function for comparing two strings either case sensitive or non case sensitive, i dont even know if it works yet lol regards lewiswould somebody be able to posibly tell me what im doing wrong, im thinking im using the enum incorectly, but i dont know how... thanks
Jan 08 2004
Lewis wrote:Matthew wrote:another bug i found in this code int result = 0; //assume failure should be int result = 1; //assume failureCan you bit a bit clearer about what you're trying to achieve and, since you said you made a typo, post again, after having converted tabs to spaces, so we can see your code in its formatted state? :) "Lewis" <dethbomb hotmail.com> wrote in message news:bthpup$2nh6$1 digitaldaemon.com...*reformatted* //enum of compare methods enum CompareMethod { BinaryCompare = 0, TextCompare = 1 } and the following function for comparing two char[] strings, (AString is an alias for char[]) and it gives me a: -no property 'CompareText' for type 'int' compile eror... public int StrComp(AString Value1, AString Value2, CompareMethod Compare) { int len1 = Value1.length; int len2 = Value2.length; int result = 0; //assume failure try { if (len1 == len2) { if (Compare == CompareMethod.CompareText) //check compare method desired { result = memcmp((char*)Value1,(char*)Value2,len1); } else {result = memicmp((char*)Value1,(char*)Value2,len1);} return result; } else { return result; } //failed, unequal length } catch { return result; } //error }after looking at it after i posted i seen the error this line > Compare == CompareMethod.CompareText should be > Compare == CompareMethod.TextCompare basically its a function for comparing two strings either case sensitive or non case sensitive, i dont even know if it works yet lol regards lewiswould somebody be able to posibly tell me what im doing wrong, im thinking im using the enum incorectly, but i dont know how... thanks
Jan 10 2004