Is there a simple function that will allow me to output an out file stream to hex from an int. Let me give you an example of what I am trying to do.

ofstream out;"c:\\test.txt");
for(int i = 0; i<20;i++)

the above code does not work, but basically I want each iteration of i to be output to a file in hex equivalent.
e.g if int i is 10 the hex output to the file would be "a"

Try something like this

#include <iostream>
#include <fstream>

int main()
    std::ofstream fout("outdata");

    for (size_t i = 0; i < 100; ++i)
        fout << "0x" << std::hex << i << std::endl;

    return 0;