values arent read correctly
Opened this issue · 2 comments
PerspectivesLab commented
Hi the values read arent working, on windows, visual studio:
std::cout << "save to " << filename << std::endl;
std::ofstream out(filename, std::ios::binary);
char a = 42;
unsigned short b = 65535;
int c = 123456;
out << bits(c) << bits(b) << bits(c) ;
is read:
a: char @
b: unsigned short : 482
c: int 1090518784
with read code :
char a;
unsigned short b;
int c;
in >> bits(a) >> bits(b) >> bits(c) ;
std::cout << std::endl;
std::cout << "read:" << std::endl;
std::cout << " a: char " << a << std::endl;
std::cout << " b: unsigned short " << b << std::endl;
std::cout << " c: int " << c << std::endl;
std::cout << std::endl;
goblinhack commented
weird - you could enable DEBUG_C_PLUS_PLUS_SERIALIZER to see what it's
doing more - confusing...
…On Mon, 22 Apr 2024 at 16:43, Perspective[S] ***@***.***> wrote:
Hi the values read arent working, on windows, visual studio:
std::cout << "save to " << filename << std::endl;
std::ofstream out(filename, std::ios::binary);
char a = 42;
unsigned short b = 65535;
int c = 123456;
out << bits(c) << bits(b) << bits(c) ;
is read:
a: char @
b: unsigned short : 482
c: int 1090518784
with read code :
char a;
unsigned short b;
int c;
in >> bits(a) >> bits(b) >> bits(c) ;
std::cout << std::endl;
std::cout << "read:" << std::endl;
std::cout << " a: char " << a << std::endl;
std::cout << " b: unsigned short " << b << std::endl;
std::cout << " c: int " << c << std::endl;
std::cout << std::endl;
—
Reply to this email directly, view it on GitHub
<#3>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADA3H4OSLK2TISUDYFMLBTY6UVZNAVCNFSM6AAAAABGTBH7GSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TMOBXHA4TONQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
goblinhack commented
It sounds like vis studio is picking up the incorrect template for short/int - the debug might help show which
another option is to try to enable USE_SIZE_T