Click here to Skip to main content
16,018,650 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Looking for opinions on currency handling.... Pin
Jeremy Falcon3-Sep-24 17:31
professionalJeremy Falcon3-Sep-24 17:31 
QuestionADDENDUM How to display full 4 binary bits - after QString "number" option converts string to int. including hexadecimal strings. Pin
jana_hus30-Aug-24 7:39
jana_hus30-Aug-24 7:39 
QuestionRe: How to display full 4 binary bits - after QString "number" option converts string to int. Pin
Richard MacCutchan30-Aug-24 8:05
mveRichard MacCutchan30-Aug-24 8:05 
AnswerRe: REOPEN How to display full 4 binary bits - after QString "number" option converts string to int. including hexadecimal strings. Pin
Richard MacCutchan3-Sep-24 21:56
mveRichard MacCutchan3-Sep-24 21:56 
Questionwrapping enum in namespace ? Pin
Maximilien29-Aug-24 3:37
Maximilien29-Aug-24 3:37 
AnswerRe: wrapping enum in namespace ? Pin
k505429-Aug-24 5:43
mvek505429-Aug-24 5:43 
GeneralRe: wrapping enum in namespace ? Pin
Maximilien29-Aug-24 6:41
Maximilien29-Aug-24 6:41 
QuestionThis should be an easy question... 128-bit blues. Pin
Jeremy Falcon28-Aug-24 11:12
professionalJeremy Falcon28-Aug-24 11:12 
Last time I did hardcore C was a while back. Before the 128-bit days. Ok, cool. But, I got a silly question when it comes to printing a 128-bit integer. You see online examples saying just do a long long cast and call it a day bro, but then they use small numbers. Which obviously works for them because it's a small number.

But, I figure hey, I'll try it for poops and giggles. As you'd might expect the number is never correct.
C
#include <stdio.h>

int main()
{
    __uint128_t u128 = 34028236692093846346337460743176821145LL;
    printf("%llu\n", (unsigned long long)u128);

    return 0;
}

The above don't do it. Now, I could bit shift to get around any limits, but I ultimately need the output formatted with comma separators, so doing bit logic would cause issues when putting humpty dumpty back together again.

So, um... anyone know how to print a 128-bit number in C? Preferably portable C.
Jeremy Falcon


modified 28-Aug-24 17:19pm.

AnswerRe: This should be an easy question... 128-bit blues. Pin
k505428-Aug-24 12:04
mvek505428-Aug-24 12:04 
GeneralRe: This should be an easy question... 128-bit blues. Pin
Jeremy Falcon28-Aug-24 12:21
professionalJeremy Falcon28-Aug-24 12:21 
AnswerRe: This should be an easy question... 128-bit blues. Pin
Mircea Neacsu28-Aug-24 14:47
Mircea Neacsu28-Aug-24 14:47 
GeneralRe: This should be an easy question... 128-bit blues. Pin
Jeremy Falcon28-Aug-24 15:03
professionalJeremy Falcon28-Aug-24 15:03 
GeneralRe: This should be an easy question... 128-bit blues. Pin
Mircea Neacsu28-Aug-24 15:11
Mircea Neacsu28-Aug-24 15:11 
GeneralRe: This should be an easy question... 128-bit blues. Pin
Jeremy Falcon28-Aug-24 15:43
professionalJeremy Falcon28-Aug-24 15:43 
GeneralRe: This should be an easy question... 128-bit blues. Pin
Mircea Neacsu28-Aug-24 15:46
Mircea Neacsu28-Aug-24 15:46 
QuestionOwn border in client area Pin
john563226-Aug-24 19:59
john563226-Aug-24 19:59 
AnswerRe: Own border in client area Pin
Richard MacCutchan26-Aug-24 22:10
mveRichard MacCutchan26-Aug-24 22:10 
AnswerRe: Own border in client area Pin
Maximilien27-Aug-24 8:22
Maximilien27-Aug-24 8:22 
QuestionData file Pin
Calin Negru26-Aug-24 2:36
Calin Negru26-Aug-24 2:36 
AnswerRe: Data file Pin
Maximilien26-Aug-24 3:29
Maximilien26-Aug-24 3:29 
AnswerRe: Data file Pin
k505426-Aug-24 3:30
mvek505426-Aug-24 3:30 
AnswerRe: Data file Pin
Dave Kreskowiak26-Aug-24 3:32
mveDave Kreskowiak26-Aug-24 3:32 
GeneralRe: Data file Pin
Calin Negru26-Aug-24 4:20
Calin Negru26-Aug-24 4:20 
QuestionInheritance and arrays thread follow up Pin
Calin Negru23-Aug-24 7:05
Calin Negru23-Aug-24 7:05 
AnswerRe: Inheritance and arrays follow up Pin
Mircea Neacsu23-Aug-24 7:38
Mircea Neacsu23-Aug-24 7:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.