On 5/21/07, int21h_d <[EMAIL PROTECTED]> wrote:
> can someone explain why the "thequickbrown..." doesnt concatenates after
> the "hello world", that is, "hello worldthequickbrownfox...." ???
>
> thanks in advance!!!
>
> int main(int argc, char *argv[])
> {
>
> char buff[80];
> sprintf(buff, "hello world");
> printf("%s\n", buff);
> buff[strlen(buff)]=strcat(buff,"thequickbrownfoxjumpsoverthelazydog");
> printf("%s\n", buff);
> getch();
> return 0;
> }
That is not how you use strcat. See:
http://www.cplusplus.com/reference/clibrary/cstring/strcat.html
As with most C string handling functions you'll have to be very
careful not to overrun your buffer.
--
Tamas Marki