mardi 4 juillet 2017

Equivalent of python bytestring representation in C++

I need to send a bytecode command over a socket to a DAQ to begin reading out the data. I have implemented this in python by doing something along the lines of: socket.send(b'$RBH\r'). I am wondering if the equivalent of this in C++ (or C) would be to send a character array over a socket in the same fashion. More explicitly is the representation of char byt[] = "$RBH\r" in C++/C equivalent to byt = b'$RBH\r' in python?

Also according to http://ift.tt/KXdhX2 the way in which I declared byt in C++/C adds a null character (\0) at the end. I assume this would have no effect on the carriage return character (\r) in terms of sending data over the socket, am I mistaken? Maybe this second part can't be answered without more knowledge of the system

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire