My point was to test the data for problems, and not cast it into something it's not.Originally Posted by Dave_Sinkula
On an aside, all of your put* functions use unsigned chars for output, at least according to the man pages. So using them with your funny-o has already converted it to an unsigned character. Whose argument that helps I'm not sure.
At any rate, the issue you were having was implementation specific. If you had read your data in as unsigned characters, or, if you had forced your char to be unsigned, you wouldn't have that problem ever. But again, my main point was that blanket typecasts won't catch EOF.
I still stand by 'test your data, then pass it to functions' rather than just blanket casting it so it fits. Hell, I could use only void * and with the right casts pass anything to whatever I felt like. It doesn't make it a good way to do things.