Skip to content
Snippets Groups Projects
Commit 1c04a5a3 authored by simsc266's avatar simsc266
Browse files

1 and 2

parents 435c0938 4a75a26d
No related branches found
No related tags found
No related merge requests found
......@@ -24,17 +24,24 @@ int main(int argc, char **argv)
char line[80];
// Fix num lines, num columns, strdup-1
FILE *fin = fopen("bible.txt", "r");
//end-of-file condition is detected after trying read, not before.
//fopen passes a NULL.
if(fin){
while (!feof(fin)) {
getline(line, fin);
lines[cur] = (char*) malloc(strlen(line));
strcpy(lines[cur], line);
cur++;
}
fclose(fin);
fclose(fin);
}
FILE *fout = fopen("copy.txt", "w");
for (int i=0; i<cur; i++) {
fputs(lines[i], fout);
}
fclose(fout);
return 0;
}
......@@ -6,7 +6,11 @@ in the blanks, but most parts of the code are very similar."""
for (name,op) in [(:add, :+), (:sub, :-), (:mul, :*)]
# Create a function that is named for example add and returns the
# sum of its two arguments
<<<<<<< HEAD
@eval $name(x,y) = $op(x,y)
=======
@eval Base.$name(x,y) = x + y
>>>>>>> 4a75a26d8d533e43444e1ecae6617eea7e575123
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment