fill a buffer successively

Posted by mkind on Stack Overflow See other posts from Stack Overflow or by mkind
Published on 2010-05-16T13:30:45Z Indexed on 2010/05/16 13:40 UTC
Read the original article Hit count: 149

Filed under:
|
|
|
|

i intend to fill a char-pointer array successively in a for-loop. the content to fill in is a integer so i need to cast. but i didn't get the result i want to..

for (i=0;i<max0;i++){
    sprintf(buf, "%d", content[i]);
}

sprintf replaces the hole buf, but i want to append.

for (i=0;i<max0;i++){
   buf[i]=(char) contint[i]
}

but this isn't working too. it seems to me, i get ascii-code of the content[i].

© Stack Overflow or respective owner

Related posts about c

    Related posts about string