Results 1 to 2 of 2

Thread: [RESOLVED] How to compare 2 strings

  1. #1

    Thread Starter
    Member
    Join Date
    May 2007
    Posts
    34

    Resolved [RESOLVED] How to compare 2 strings

    Hi!
    I have a memory block where are many strings, but I cant compare them with a constant string!
    Example:
    "if" statement is using sizeof() and its not using strlen()
    Is there some functions or do I need to make a for loop (which is slow) for checking the data?
    Code:
    	char*pMem2="My Compare Text\0dsdfsdfsd";
    	char*Name2="My Compare Text";
    	if (pMem2 == Name2){
    		return 1;
    	}
    	return 0;

  2. #2

    Thread Starter
    Member
    Join Date
    May 2007
    Posts
    34

    Re: How to compare 2 strings

    Solved!
    Searched on forum and found strcmp();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width