diff options
author | daniel-Jones <daniel@danieljon.es> | 2018-10-16 21:30:18 +1030 |
---|---|---|
committer | daniel-Jones <daniel@danieljon.es> | 2018-10-16 21:30:18 +1030 |
commit | ac7d855e4e8202d99867cf6be3101bba5dd13001 (patch) | |
tree | 74da5bca0aaaf737e74393088424eb978e91c727 /main.c | |
parent | 442d3a8d8fcf1a65e4584d64bab10d5651053789 (diff) | |
download | replace-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.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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; } |