As has been said already, 0x0A
is equal to decimal 10
(ten). This is equal to the ASCII code for LF (Line Feed), which is a newline on many systems. But in your case, you use DisconnectClient
, which takes a ULONG
. Whether you would pass 0xA
or just 10
doesn't matter.
The meaning of this number, in this case, is the interface on which the client is connecting.
EDIT: looking again at your code, your disconnectClient
function is different from the one on MSDN. If it is a user defined method, finding out the meaning of 0x0A
requires checking that method itself, or its documentation (though it is possible that it is just a stub to the "real" DisconnectClient
, and simply passes on the parameter).
Understanding hexadecimal
EDIT: In case you are wondering how all answerers here seem to know that hexadecimal 0x0A
equals decimal 10
, read on:
Hexadecimal numbers are base-16 (hexa = 6, deca = 10). We are nowadays accustomed to base-10, but history shows that base-20 (France still has quatre-vingt), base-5 (Russia) and others have been used even before the event of binary (base-2) numbers became common for computers. Base-16 is just as base-10, but now you don't have 10 fingers, but 16 instead.
Computers can only think in bits, four bits (a nibble) can make the numbers 0-15. To make it easier to read and write about bits, hexadecimal notation was used. This adds A-F to the ubiquitous digits 0-9, where A equals 10, B equals 11 until F equals 15.
In programming languages, it is common to start a number with x
, 0x
or &h
(depending on the language) to denote a hexadecimal number. Leading zeroes, just as with decimal numbers, can be ignored. Trailing zeroes have their obvious meaning.
Transform hexadecimal into decimal
So, how would you go from a hexadecimal to a decimal number? Each digit should be multiplied to a power of 16, instead of a power of 10 for decimal. There's a simple generic formula to get from any base-X to any base-Y, but here's it applied to going from base-16 to base-10.
- Take each hex digit, write its decimal version down
- Multiply each digit with
16^pos
, where pos == position in hex number, right-most position is zero
- Add the results
The number 0x8B20
becomes:
8 * 16^3 = 8 * 4096 = 32768
B * 16^2 = 11 * 256 = 2816
2 * 16^1 = 2 * 16 = 32
0 * 16^0 = 0 * 1 = 0
------- +
35616
Rather tedious to do by hand, but you get the drift, I hope. If you have Windows, type Calc in the Run-Window or the search box (Vista, W7) and click View > Scientific. Now you can type hexadecimal numbers (hit F5) and switch between decimal (F6), octal (F7) and binary (F8).
There's a lot more to say about numbers and their bases, but if you need more, I suggest you take a look at the math forum faq, or on Wikipedia (more general). To convert between many bases, try this online base-X calculator.
Update: added sections on understanding and transforming hexadecimal numbers, thought it was perhaps applicable ;-)