A89: Re: A C question


[Prev][Next][Index][Thread]

A89: Re: A C question




instead of this:
ev->extra.pasteText[strlen(ev->extra.pasteText)-1] = '\0';

use this:
strcpy(ev->extra.pasteText + (strlen(ev->extra.pasteText)-1), "\0");

and that should remove the ")" at the end.

----- Original Message -----
From: Mike Grass
To: Assembly-89
Sent: Wednesday, June 21, 2000 12:41 AM
Subject: A89: A C question


Hmm, any thoughts as to why this doesn't work?  I am trying to strip off the
'(' character at the end of the string by writing a null character over it,
but when I try the code, it leaves the '(' character at the end.  Anyway, I
have some other code that does basically the same thing, and it does work,
and I can't figure out why this doesn't work.
EVENT *ev;
......
if(ev->extra.pasteText[strlen(ev->extra.pasteText)-1] == '(')
{
    ev->extra.pasteText[strlen(ev->extra.pasteText)-1] = '\0';
    printf("%s",ev->extra.pasteText);
    ngetchx();
}




Follow-Ups: References: