# Displaying A Uint64\_t

**URL:** <https://discourse.libsdl.org/t/displaying-a-uint64-t/31425>\
**Category:** Game Development\
**Created:** [April 30, 2021, 10:30pm UTC](https://discourse.libsdl.org/t/displaying-a-uint64-t/31425 "2021-04-30T22:30:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![advigames](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/a/dec6dc/32.png) [@advigames](https://discourse.libsdl.org/u/advigames)\
**Post date:** [April 30, 2021, 10:30pm UTC](https://discourse.libsdl.org/t/displaying-a-uint64-t/31425/1 "2021-04-30T22:30:58Z")

</div>

ive decided to make a game similar to adventure capitalist using SDL2 and TTF and it appears i cannot render a number higher than the maximum number of a signed 32 bit integer, but i want to be able to render number as high as the maximum value of an unsigned 64 bit integer, is there any way i can get around this rather low limitation?

---

<div class="post-metadata">

**Author:** ![icculus](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/icculus/32/81_2.png) [@icculus](https://discourse.libsdl.org/u/icculus)\
**Post date:** [April 30, 2021, 11:45pm UTC](https://discourse.libsdl.org/t/displaying-a-uint64-t/31425/2 "2021-04-30T23:45:16Z")

</div>

You can render arbitrary strings, so make a string:

```auto
char str[64];
SDL_snprintf(str, sizeof (str), "%" SDL_PRIu64, MyUint64Value);

```

Then render `str` instead of the original Uint64.

---

<div class="post-metadata">

**Author:** ![advigames](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/a/dec6dc/32.png) [@advigames](https://discourse.libsdl.org/u/advigames)\
**Post date:** [April 30, 2021, 11:54pm UTC](https://discourse.libsdl.org/t/displaying-a-uint64-t/31425/3 "2021-04-30T23:54:57Z")

</div>

when ever i do that it works just as my original buffer did and renders the max value at -6, here is my buffer line:

```
SDL_DestroyTexture(ScoreTex); SDL_FreeSurface(ScoreSur); char ScoreBuf[256]; sprintf_s(ScoreBuf, "Score: %i", (int)Score); ScoreSur = TTF_RenderText_Blended(ScoreFont, ScoreBuf, ScoreColor); ScoreTex = SDL_CreateTextureFromSurface(ren, ScoreSur); SDL_QueryTexture(ScoreTex, NULL, NULL, &Score_Rect.w, &Score_Rect.h);
```

---

<div class="post-metadata">

**Author:** ![icculus](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/icculus/32/81_2.png) [@icculus](https://discourse.libsdl.org/u/icculus)\
**Post date:** [May 1, 2021, 12:13am UTC](https://discourse.libsdl.org/t/displaying-a-uint64-t/31425/4 "2021-05-01T00:13:21Z")

</div>

`sprintf_s(ScoreBuf, "Score: %i", (int)Score);` casts the value to an int (which is a signed 32-bit value in this case) before converting it to a string.

Try this instead: `sprintf_s(ScoreBuf, "Score: %" SDL_PRIu64, (Uint64) Score);`

---

<div class="post-metadata">

**Author:** ![advigames](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/a/dec6dc/32.png) [@advigames](https://discourse.libsdl.org/u/advigames)\
**Post date:** [May 1, 2021, 12:29am UTC](https://discourse.libsdl.org/t/displaying-a-uint64-t/31425/5 "2021-05-01T00:29:01Z")

</div>

there we go, thank you!
