Inputing and Outputing Hexdecimal Integers with iostream

Posted on In Programming

It is straightforward. I just put the example code:

#include <fstream>
#include <iomanip>

using std::cout;
using std::ifstream;
using std::ios;
using std::hex;

int main(){
    ifstream is("e:testtest.txt");
    int i = 0;
    is >> hex >> i;
    cout << hex << i << endl;
    return 0;

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *