Skip to main content
3 votes
Accepted

What is the value read in the following code? if the open.txt file contains 1 to 10 numbers

Actually, the program is working exactly as designed. Unfortunately, it isn't what you think. ;-) If you run the program, it will essentially copy the input file to the output file. Along the way, ...
Cliff B's user avatar
  • 69.3k
2 votes
Accepted

I know that my recover is wrong, but I'm not sure what steps to take-

There are several issues and areas for improvement here. First, there's this: FILE *f = fopen("argv[1]", "r"); By putting argv[1] in quotes, you're saying to treat whatever is in ...
Cliff B's user avatar
  • 69.3k
1 vote

What is the value read in the following code? if the open.txt file contains 1 to 10 numbers

The fread and fwrite functions are working fine, as expected, the problems are elsewhere, a somewhat more coherent way of writing your program will be the following: #include <stdio.h> #include ...
MARS's user avatar
  • 5,179

Only top scored, non community-wiki answers of a minimum length are eligible