From 33994d7dac79cd0767a10d2f1191732f5ebc1ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20J=C3=A4rpehult?= <oscja033@student.liu.se> Date: Wed, 16 Oct 2019 09:27:37 +0200 Subject: [PATCH] Update fileutil.cpp --- debugging/fileutil.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/debugging/fileutil.cpp b/debugging/fileutil.cpp index 4914bc8..dd3af94 100644 --- a/debugging/fileutil.cpp +++ b/debugging/fileutil.cpp @@ -20,14 +20,15 @@ using namespace std; int main(int argc, char **argv) { int cur = 0; - char *lines[16536]; - char line[80]; + char *lines[33072]; + char line[800]; // Fix num lines, num columns, strdup-1 FILE *fin = fopen("bible.txt", "r"); while (!feof(fin)) { + memset(line, 0, 80); getline(line, fin); lines[cur] = (char*) malloc(strlen(line)); - strcpy(lines[cur], line); + stncpy(lines[cur], line); cur++; } fclose(fin); -- GitLab