-
printf-like function ?
Hi folks,
New to C, quick question about string manipulation. :rolleyes:
I need a highly efficient function to replace parameters in a string, basically the same way that printf works.
char *template = "foo %s bar %s ...";
newString = replaceParams(template, "param1", "param2");
Is it possible to just redirect printf ? (as long as printf is efficient)
Otherwise whats my best option (algorithm)?
Thx
-
Maybe strcpy and sprintf is what you are looking for. google them. To be honest I didn't really understand you
-
Good enough! I didn't know about sprintf, thats all I really needed. Thanks! :)
-
Happy that helped! Also, welcome to the forum and have a happy && healthy new year!