There is a client on java, a wav file is sent from it to the c ++ server.

How to correctly write the received data to a file if the server accepts values ​​in the char array. If you write it, the file size will be 50 times smaller than the size of the received data, if you write the array character by character, then only noise will be in wav, but if you send this char back to the client and write there, then everything is fine.

How do char translate to byte or how to write char so that everything is playing normally?

  • one
    show how to write. I think that in the first case, you just write down the size. Or write wrong (well, it can not just be 50 times smaller). - KoVadim
  • It seems to me that this question has no answer because the question is actually Java, but the corresponding tag is not specified. - Arkady
  • one
    I will assume that the author is trying to write an array to a file as a regular string, forgetting that there can be zero bytes in the array. - dzhioev
  • And the resulting string contains absolutely any characters, including non-printable ones, or is it encoded binary data, for example Base64 or some Uuencode? - Andrey Epifantsev

0