I need to do what most packet monitoring programs do (Wireshark, tcpdump, etc.). When data is received through Winsock, I just need to convert the packet to a hex representation and save it to file.
The data is just a simple char array.
I've tried lots of things like sprintf but with no luck. I also don't want to use itoa since it's not standard C from what I've learned.
Example:
If the packet contains "test", then it should be dumped to file as "74 65 73 74".
I can do all of the file handling stuff, and the Winsock code is working, I guess I just need to write a function to convert a char array to a hex representation, and I can't seem to get it.