2
2b|!2b==?
I am not making much progress porting some old C code to C++ ...
I am porting the lines below, which prints an ISO8601 date string:
char buff[16] ;
memset(buff, '\0',16);
sprintf(buff,"%02d:%02d:%02d", hours, minutes, seconds) ;
to :
std:stringstream os ;
os << std::setprecision(2) << hours << ":" << std::setprecision(2) <<
minutes << std::setprecision(2) << seconds ;
The C++ code compiles ok, but I am getting the wrong formatting (i.e.
for old time C programmers) - its as if I'm using the format string
"%2d:%2d%2d"
Can anyone spot where I'm going wrong ?
I am porting the lines below, which prints an ISO8601 date string:
char buff[16] ;
memset(buff, '\0',16);
sprintf(buff,"%02d:%02d:%02d", hours, minutes, seconds) ;
to :
std:stringstream os ;
os << std::setprecision(2) << hours << ":" << std::setprecision(2) <<
minutes << std::setprecision(2) << seconds ;
The C++ code compiles ok, but I am getting the wrong formatting (i.e.
for old time C programmers) - its as if I'm using the format string
"%2d:%2d%2d"
Can anyone spot where I'm going wrong ?