Thread: Replacing string in C
hi. let's have strings in c:
c2 @ large c1. if want replace "hello" in c1 contents of c2, c1 "bye"?. there way this?code:char *c1 = "hello"; char *c2 = "bye";
if understand want, recommend using strncpy.
i think it. buf_size macro maximum size of string, maybe 256 or less ridiculous maybe 64. or put strlen in there.code:c1 = strncpy(c1, c2, buf_size);
i think meant.code:c1 = strncpy(c1, c2, strlen(c2));
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Replacing string in C
Ubuntu
Comments
Post a Comment