summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authordaniel-Jones <daniel@danieljon.es>2018-10-16 21:30:18 +1030
committerdaniel-Jones <daniel@danieljon.es>2018-10-16 21:30:18 +1030
commitac7d855e4e8202d99867cf6be3101bba5dd13001 (patch)
tree74da5bca0aaaf737e74393088424eb978e91c727 /main.c
parent442d3a8d8fcf1a65e4584d64bab10d5651053789 (diff)
downloadreplace-ac7d855e4e8202d99867cf6be3101bba5dd13001.tar.gz
replace-ac7d855e4e8202d99867cf6be3101bba5dd13001.zip
added function to replace strings in memory as well, added an example to main.c
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/main.c b/main.c
index 8efc66c..a0b7b4d 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#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;
}