MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / dumpFile

Function dumpFile

tools/generate_resources.cpp:38–61  ·  view source on GitHub ↗

* Add the content of the given filename to the resources. * @param filename File to add to the resources. */

Source from the content-addressed store, hash-verified

36 * @param filename File to add to the resources.
37 */
38void dumpFile(const std::string& filename)
39{
40 using namespace std;
41
42 ifstream f(filename.c_str(), ios::binary);
43
44 unsigned char buffer[1024];
45
46 while(!f.eof())
47 {
48 f.read(reinterpret_cast<char *>(buffer), sizeof(buffer));
49 size_t n = f.gcount();
50
51 if(n == 0) break;
52
53 cout << hex << setw(2) << setfill('0') << " ";
54 for(size_t i = 0; i < n; ++i)
55 {
56 cout << "0x" << int(buffer[i]) << ", ";
57 }
58 cout << endl;
59 }
60 cout << dec;
61}
62
63/**
64 * Main application entry point.

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected