The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Compare and lstrcmp
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

peter.cook

UK
356 Posts

Posted - 01/28/2004 :  2:42:15 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

What are the differences in the two functions Compare and lstrcmp for comparing strings?

Cheers,

Pete

cpyang

USA
1406 Posts

Posted - 01/28/2004 :  5:09:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
same, just one is member function of string class while the other is a standard C function that will take two LPCSTR. For example, if you have

char szTemp[10];
lstrcpy(szTemp,"AA");
char szTemp1[10];
lstrcpy(szTemp, "BB");

then you can only use lstrcmp,
or you will need to do things like

string strTemp = szTemp;
if(strTemp.Compare(szTemp1)!=0) { }

CP


Go to Top of Page

peter.cook

UK
356 Posts

Posted - 01/28/2004 :  6:10:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Thanks for clarification CP.

Cheers,

pete

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000