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.2k
1 vote
Accepted

pset3 recover is fopen changing the first value in my buffer?

I'll bet money on this one. What's the declaration for filename? Is it less than 8 chars? I bet it's 7 chars long and you forgot about the end of string marker. This is a very common error in ...
Cliff B's user avatar
  • 69.2k
1 vote
Accepted

PSET4 Recover images not showing correctly

The logic of the program has some serious flaws. While individual statements are functioning correctly, its the overall logic that isn't working. Go back and look at what the program is doing. Read ...
Cliff B's user avatar
  • 69.2k
1 vote

Files Won't Open In The Directory

Remember that you need to make a new file to write the images two. It looks like you successfully open card.raw, but all you do is name it in your for loop. You probably want to first read from your ...
dumbitdownjr's user avatar
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
1 vote
Accepted

PSET8: fopen() not working for import

You added an extra unwanted ; on this line: if ($handle == FALSE); Remove the semicolon and it will work as wanted.
ChrisG's user avatar
  • 7,396
1 vote
Accepted

Why I cant open the input file using fopen

fopen takes a pointer to the file and you've given it a string "input". Try fopen(input, "r"); instead of fopen("input", "r"); Do you see the difference? In the first, you are telling fopen that ...
curiouskiwi's user avatar
  • 18.7k

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