handmade/test/test_FileIO.cpp

36 lines
557 B
C++
Raw Normal View History

#include "FileIO.h"
#include "util.h"
#include <string>
#include <iostream>
#include <stdint.h> /* uint8_t */
#include <stdio.h>
#include <math.h>
int
main (int argc, char **argv)
{
int rc;
rc = 1;
try
{
while (argc-- > 1)
{
FileIO f (argv[argc], "r");
std::string buf = f.ReadToString ();
if (util_IsProbablyAscii (buf.c_str (), buf.size ()))
std::cout << buf << std::endl;
else
util_HexDump (buf.c_str (), buf.size ());
rc = 0;
}
}
catch (const std::string& e)
{
std::cerr << e << std::endl;
}
return rc;
}