Writing code with Winsock.
I currently have this:
fwrite(buff, 1, len, stdout);
How to do it like:
for ( int i = 0; i < len; i++ ) {
printf( "%02x ", unsigned char (buff[i]) );
}
printf( "\n" );
Or should I just remove the fwrite and use the print instead?
I wanted to write it to stdout, cuz I have my option to either write to stdout of write to file.
fprintf
(see the docs) is like printf
but to an arbitrary file:
fprintf(stdout, "%02x ", unsigned char (buff[i]));