diff --git a/debugging/fileutil.cpp b/debugging/fileutil.cpp index f4dcc731bcc869e38495d5b36afd60b2aba20bb9..8bde202aaba5ad89c030762c2bb9a055b06c4d1b 100644 --- a/debugging/fileutil.cpp +++ b/debugging/fileutil.cpp @@ -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; } diff --git a/julia/run.jl b/julia/run.jl index bf6be0002f996664ca2553513b96ba100d701f9a..6e66ff01ef5cf813292e0200f29d8cf1196a2eba 100644 --- a/julia/run.jl +++ b/julia/run.jl @@ -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