I need to conver decimal numbers to 4 digit lower-case hex numbers prefixed by 0x.
“%X” is good enough, but this is not exactly what I want.
printf("hex num is: %X\n", num);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I guess you need either
0x%04xor%#06x.%xmeans lower-case hex.0means padding with zeros if shorter than the specified number of digits.4or6specifies the desired width.#means0xprefix.