c++ - Left of the dot precision -


what i'm trying write this

file << somefunction(5) << hex << 3; 

and output 00003 instead of 3 (and 300 00300, etc)

note:- sorry if asked before, don't know term search this

edit:- mean zero's left, included hex part clear want compatible format

i believe mean.

#include <iostream> #include <iomanip> int main() {    std::cout << std::setw(5) << std::setfill('0') << 3 << '\n';    return 0; } 

output

00003 

links setw, setfill.

edit: also, see std::internal at question.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -