It should work fine with binary files. Therefore, I'd say you have a bug.
Now, what type of bug would lead to the strange behavior you observe? Well,
for starters does it work with multiline text files or just with a single
line text file? If that does not help I suggest you debug your software
using e.g., "gdb", to find out what the problem is.
Tor
Post by Liu Brian Su-HouIt's an int so I don't think that's the problem.
Post by John TanWhat type of variable is receiving the value from fgetc()?
If u use something like char c = fgetc() that is the problem, you need to
change to int c = fgetc()
Post by Liu Brian Su-HouI really can't find what's wrong. How is it possible that my program is
able to encode/decode text files perfectly regardless of size and doesn't
work when I try to do bin,jpg,etc..