I am trying to find out how to replicate the output of fwrite("andbe", 4, 1, output);

an encryption algorithm I am using writes its output as this, but I am sending data across a network, and need to be able to write this to a string to send.

The algorithm writes all of its output in 4-byte chunks, and reads them the same way.

The problem is that it also writes strings that are much less than 16 characters as four bytes, which it can read with fread("...", 4, 1, input) but I cannot seem to replicate as just strings?

Is there a way to see what the fwrite would be writing/how it is padding the extra space?

7 Years
Discussion Span
Last Post by thines01
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.