Skip to content
Snippets Groups Projects
Commit 33994d7d authored by Oscar Järpehult's avatar Oscar Järpehult
Browse files

Update fileutil.cpp

parent 24236a7e
No related branches found
No related tags found
No related merge requests found
...@@ -20,14 +20,15 @@ using namespace std; ...@@ -20,14 +20,15 @@ using namespace std;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int cur = 0; int cur = 0;
char *lines[16536]; char *lines[33072];
char line[80]; char line[800];
// Fix num lines, num columns, strdup-1 // Fix num lines, num columns, strdup-1
FILE *fin = fopen("bible.txt", "r"); FILE *fin = fopen("bible.txt", "r");
while (!feof(fin)) { while (!feof(fin)) {
memset(line, 0, 80);
getline(line, fin); getline(line, fin);
lines[cur] = (char*) malloc(strlen(line)); lines[cur] = (char*) malloc(strlen(line));
strcpy(lines[cur], line); stncpy(lines[cur], line);
cur++; cur++;
} }
fclose(fin); fclose(fin);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment