Example |
Specification |
Meta-usage | |
Backslash
Escapes in C, C++, Java, etc |
\n |
n (meaning 0x0A) r (meaning 0x0D) t (meaning tab) " (meaning literal quote) \ (meaning literal backslash) x<hex digit><hex digit><NON hex digit> 0-7<octal digit><octal digit> |
"\\\"Hello\\\"" |
URL
Encoding |
%2F |
%<hex digit><hex digit> |
%2525 |
Ampersand
Encoding in HTML |
< |
&<short string>; |
&amp; |
... somehow get a length len ...You can have a fixed length for len (e.g., always 4 or 8 bytes), although then you need to do something special for exchanges bigger than this. DER, for its flaws, uses an interesting encoding based on a single byte:
std::vector<char> buf(len);
skt_recvN(s,&buf[0],len);