View previous topic :: View next topic |
Author |
Message |
small_chick
Joined: 17 Jul 2012 Posts: 53
|
functions for string process ? |
Posted: Wed Dec 05, 2012 6:27 pm |
|
|
I’ve read functions for string process in CCS user manual and I’ve got some questions as follow:
●cresult = strcmp(s1,s2)
As said in CCS user manual, cresult’s value may be -1 or 0 or 1 => so what type of cresult ? signed int8 or signed int16 or signed int32 ?
●iresult = strncmp(s1,s2,n)
As said in CCS user manual, iresult is an 8 bit int, but it doesn’t mention the meaning of this variable ! iresult has the same meaning as cresult above or it has a different meaning ?
●ptr = strstr(s1,s2) => means search for s2 in s1
However, I wonder what type of result “ptr” gets ? an address or something else ?
Hoping someone can give me an explanation ! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Dec 05, 2012 7:04 pm |
|
|
Look in the string.h file, in this directory:
Quote: |
c:\program files\picc\drivers\string.h
|
It has the source code for those string functions. You can look at the
function declaration and see the type and the size of the return value. |
|
|
small_chick
Joined: 17 Jul 2012 Posts: 53
|
|
Posted: Thu Dec 06, 2012 6:26 am |
|
|
Thanks PCM Programmer ! I'll try it! |
|
|
|