Question: I have a function that should take as parameter an unsigned long long in the hex format. I am trying to convert this parameter to a string to check if it is made of 16 digits or not, but I am having problems with leading zeros

```
template <typename T>
static string to_string(const T& value) {
stringstream oss;
oss << hex << setprecision(16) << value;
return oss.str();
}

int main(int argc, char** argv) {

    unsigned long long pattern1 = 0x0000001000000002;
    unsigned long long pattern2 = 0x0FFFFFFFFFFFFFFFF;

    cout << "Pattern 1 = " << to_string(pattern1) << endl;
    cout << "Pattern 2 = " << to_string(pattern2) << endl;

    return 0;
}

```

What I want is for the pattern 1 to be converted with the zeroes to be able to check its length but this is the output. I tried using the set precision but didn't seem to help

```
Pattern 1 = 1000000002
Pattern 2 = ffffffffffffffff

```

Answer: 
Do you know how many characters should be in a number? The count of leading zeros can be infinite. I think this helps you

```
int character_count = 10;
oss << hex << setfill('0') << setw(character_count) << value;

```
The length of an `unsigned long long` represented as an hexadecimal number, including leading zeros, is:

```
sizeof(unsigned long long)*2

```

Since we are including leading zeros, the value of the `unsigned long long` is not relevant.