From ac7d855e4e8202d99867cf6be3101bba5dd13001 Mon Sep 17 00:00:00 2001 From: daniel-Jones Date: Tue, 16 Oct 2018 21:30:18 +1030 Subject: added function to replace strings in memory as well, added an example to main.c --- main.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index 8efc66c..a0b7b4d 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,5 @@ #include +#include #include "replace.h" int @@ -8,5 +9,8 @@ main(void) ret = replaceinfile("input.txt", "output.txt", "%PLACEHOLDER%", "replacement string"); if (ret == 0) puts("failed"); + char *rep = replaceinmemory("this string this string is a test string", "string", "word"); + printf("%s\n", rep); + free(rep); return 0; } -- cgit v1.2.3