Help with length of buffer

This is a discussion on Help with length of buffer within the C++ Programming forums, part of the General Programming Boards category; For the third parameter of the recv() function MSDN says:
"The length, in bytes, of the buffer pointed to by ...

>> Does it mean the size of the char[] variable or the length of the data in it?

The size of the buffer itself (the length of the text in the buffer doesn't really matter, anyway, since it's just going to be overwritten).

>> For example: "Hello world" is 12 characters long (with the '\0') which would be 1 byte because you can put 256 characters in one byte.

Not exactly. An 8 bit byte can hold *one* of 256 possible values. Or *eight* of 2 possible values (if you packed each value onto a single bit). You can do a better than that with certain compression schemes (such as arithmetic encoding), but that's beyond the scope of this post (see: information theory). The point is, using standard ASCII coding, 12 characters == 12 bytes.