Re: build warnings



Paul wrote:

"Paul Russell" <prussell@xxxxxxxxx> wrote in message
news:4d5aikF18fr8kU2@xxxxxxxxxxxxxxxxx

adrian.bartholomew@xxxxxxxxx wrote:


whats wrong with this?

stringTemp[strlen(string)] = NULL;


NULL is a pointer, not a char.

Try this:

stringTemp[strlen(string)] = '\0';

Paul


I hope this isn't from actual code...

Assuming that what you want to do is write the null terminator byte on
stringTemp,
stringTemp[strlen(string)]
is indeed that byte (since the first byte is stringTemp[0] ), but strlen()
will not work (will probably crash, in fact) unless the final byte is 0
already, making it pointless to write it again.

Another Paul


Look again - it's two different strings: stringTemp and string.

And yes, it's horrible code - but everyone's got to start /somewhere/.

The First Paul
.



Relevant Pages

  • Re: ATWT/ New Craig
    ... What dark haired actor? ... I remember the previous Paul as being blond. ... Paul Ryan before Holroyd a brunette? ... The very first Paul was dark headed, that is when Emily was doing her thing with his daddy and he fell for her then. ...
    (rec.arts.tv.soaps.cbs)
  • Re: Take that Arnie
    ... > Paul M. Cook wrote: ... That much and more of private money down ... The terminator has been terminated. ... nice try paul but the moron trophy goes to, ...
    (alt.smokers.cigars)