[PD] vista & win7 support ?

Mathieu Bouchard matju at artengine.ca
Fri May 14 05:36:23 CEST 2010


On Thu, 13 May 2010, Mathieu Bouchard wrote:
> On Thu, 13 May 2010, Hans-Christoph Steiner wrote:
>> Or maybe:
>>       binbuf_gettext(bb, &buf, &bufsize);
>>       strncat(buf, "\0", strlen(buf)-bufsize);
> strncat will copy at most strlen(buf)-bufsize, but it will also copy at most 
> strlen("\0") bytes, and strlen("\0") is zero, because strlen actually is just
>  long strlen (const char *start) {
>    const char *end = start;
>    while (*end) end++;
>    return end-start;
>  }

... but also, strncat(buf,...) needs a well-defined strlen(buf) in the 
first place, which only exists if buf has a null terminator before you 
start. only in this case, strncat will be guaranteed to have the correct 
behaviour, which is to have no effect at all in this case.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801


More information about the Pd-list mailing list