i m using char pointers to take data from char arrays of 4096 bytes and storing them into a file.
the problem is............
if the data consist of only one buffer than the two datas are same but if there are more than two buffers than the data is different when compared.

at the end of each buffer an extra char comes what is that and how to solve it .
Please Help

The extra char is probably the null terminator. Have your loop check for '\0' and terminate without processing when it's detected.