Searching \ for 'CCS compiler string problems.' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=ccs+compiler+string
Search entire site for: 'CCS compiler string problems.'.

Truncated match.
PICList Thread
'CCS compiler string problems.'
1998\03\19@142448 by SHAWN ELLIS

flavicon
face
Hi all,

I have the latest version of CCS's PCW compiler and I'm trying to
compare two strings.  I notice the strcmp function is declared:

signed int strcmp(*s1, *s2);

Does this mean that when I call it I must use:

intvar = strcmp(&s1[0], &s2[0]);

In effect passing the address of the FIRST ELEMENT of the string?  Or
is there some other code which must be used to call this function?

Thanks,

1998\03\19@142448 by SHAWN ELLIS

flavicon
face
Hi all,

I have the latest version of CCS's PCW compiler and I'm trying to
compare two strings.  I notice the strcmp function is declared:

signed int strcmp(*s1, *s2);

Does this mean that when I call it I must use:

intvar = strcmp(&s1[0], &s2[0]);

In effect passing the address of the FIRST ELEMENT of the string?  Or
is there some other code which must be used to call this function?

Thanks,

1998\03\19@164531 by WF AUTOMACAO

flavicon
face
SHAWN ELLIS wrote:
>
> Hi all,
>
> I have the latest version of CCS's PCW compiler and I'm trying to
> compare two strings.  I notice the strcmp function is declared:
>
> signed int strcmp(*s1, *s2);
>
> Does this mean that when I call it I must use:
>
> intvar = strcmp(&s1[0], &s2[0]);
>
> In effect passing the address of the FIRST ELEMENT of the string?  Or
> is there some other code which must be used to call this function?
>
> Thanks,

Not is necessary the & and [0].

One problem that i found on CCS, is the function strstr. But i have
implemented!

Do you want?

Miguel.

1998\03\19@185503 by Ron Kreymborg

flavicon
face
Shawn

You could do that, but in C the name of a string variable is already a
pointer. Thus for a string declared as "char s1[5]", you could pass its
address as either "s1" or "&s1[0]". It's easier to use the former. Thus
strcmp() can be called with:

 intvar = strcmp(s1, s2);

Note that if you wanted to start the comparison from the second character
in both strings, then you would need to declare the addresses
specifically:

 intvar = strcmp(&s1[1], &s2[1]);

Ron

On Thu, 19 Mar 1998, SHAWN ELLIS wrote:

{Quote hidden}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ron Kreymborg                   Computer Systems Manager
Monash University               CRC for Southern Hemisphere Meteorology
Wellington Road
Clayton, VIC 3168               Phone     : 061-3-9905-9671
Australia                       Fax       : 061-3-9905-9689
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1998\03\20@171307 by SHAWN ELLIS

flavicon
face
Hi all,

My next CCS compiler question is about converting numbers to strings
and strings to numbers.

I wish to send numeric values to the PIC from the PC.  Is there a CCS
function that can convert a string to a number?  Or a number to a
string?

Is there a CCS function that can convert a character to it's code?
Or a code to a character?

Thanks,

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...