From 7a49b40b3e0af3c2ea2a6450817cd2e8fc0e743f Mon Sep 17 00:00:00 2001 From: Jacob Date: Sat, 18 Jan 2020 08:12:48 -0500 Subject: [PATCH] Small change to filemode --- main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.c b/main.c index 7dd0129..ca57ea5 100644 --- a/main.c +++ b/main.c @@ -43,15 +43,13 @@ FILE *fopenHostsFile(char *mode) { * @param hostsFile */ void modifyHostsFile(char *oldhost, char *newhost, int deleteHost) { - FILE *hostsFile = fopenHostsFile("r"); + FILE *hostsFile = fopenHostsFile("r+"); char buf[256]; char *ptr, *f; char newHostsFile[4096]; memset(newHostsFile, 0, 4096); -// fseek(hostsFile, 0, SEEK_SET); - while (fgets(buf, 256, hostsFile) != NULL) { f = strcasestr(buf, oldhost); -- 2.17.1