wprintf problems with long int c++

Asked

Viewed 43 times

0

Hello, I’m having trouble trying to "print" on "big" integers in c++.

To be more specific, using the visual studio 2017

int main() {
    _setmode(_fileno(stdout), _O_U16TEXT);
    long rr = 6448915477954560;
    wprintf(L"%ld\n", rr);
}

Problem: value shown on console, differs from typed, printing: 608174080

  • 1

    And why use the wprintf()? Why not use the good old cout?

  • 1

    for aesthetic reasons on the console, I am using the "_setmode" to allow the use of type characters: "çñãê..." on the console, this forces me to use wprintf. However, when removing _setmode and using Cout again normally, the problem continues (this only happens in vs2017)

  • It’s weird because VS2017 is just an IDE. And I use everything right with cout, so the problem is something else. https://answall.com/q/101691/101

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.