I'm wanting to piece together a binary string before sending it over UDP. This will be running in C on very small linux computers. I'm hoping there exists some way to do this in C similar to how I'd use a BinaryWriter
to do this in C#. I'm hoping to be able to push an int as 4 bytes onto the end of the char array, push all of another string onto the end, or a short as 2 bytes, etc.
I don't know C very well and anytime I google something, C++ always comes up but I can't get vector or stringstream (sstream?) to compile. It simply says they're undeclared.
How I'm compiling:
gcc -o test test.c
I need to have a char*
all built before I pass it to sendto
where I'm sending over the UDP port.