Can't save file! [NULL Byte termination]

This is a discussion on Can't save file! [NULL Byte termination] within the Networking/Device Communication forums, part of the General Programming Boards category; Hi!
I writed a simple server, that sends an ELF file everytime someone connects to it. But the problem is ...

It reads only first 14 bytes. The 15th character is NULL. Why doesn't ir read, I opened it as "rb", but still it reads only until it reaches NULL character!

I have another question! I created a loop, where client recives data, and with strcmp the recived data is compared with the old data, so it fits all in one big buffer. But the problem is that after the compering, the big buffer is only 140 bytes long, it should be 13790. Here is the code:

> It reads only first 14 bytes
Because you used a string function to find out the length - remember, it's binary data.
Use the return result of fread (which you're currently ignoring) to find out how much data you read.

> why is fwrite better than fprintf ?
It's different, not better.

> and with strcmp the recived data
YET more string functions on binary data.
Use memcmp() if you want to compare binary data!