Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iomanip>
- #include <sstream>
- // http://www.sfml-dev.org/forum/viewtopic.php?t=5996
- int main(int argc, char** argv)
- {
- if (argc <= 2)
- return -1;
- std::ifstream in(argv[1], std::ios::binary);
- std::ofstream out(argv[2]);
- out <<"const char data[] = { ";
- char c = 0;
- while ( in.read( &c, 1 ) )
- {
- std::stringstream ss;
- ss << std::hex << std::setfill( '0' ) << std::setw( 2 ) << std::setprecision( 2 ) << static_cast< short >( c );
- out << "0x" << ss.str().substr( ss.str().length() - 2 ) << ", ";
- }
- out << "};";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement