handmade/test/test_FileIO.cpp
Bubblegumdrop 9e957d466f Client and Server tweaks. This commit breaks the Client.
Server listens correctly with threads and stdin reader thread.

Client does nothing currently gutting UDP_Write for a UDPbase class
introduced in this commit.
2022-01-08 18:59:40 -05:00

36 lines
564 B
C++

#include "FileIO.h"
#include "util.h"
#include <stdint.h> /* uint8_t */
#include <stdio.h>
#include <math.h>
#include <errno.h> /* errno */
#include <string.h> /* strerror */
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 (IsProbablyAscii (buf.c_str (), buf.size ()))
printf ("%s", buf.c_str ());
else
HexDump (buf.c_str (), buf.size ());
rc = 0;
}
}
catch (int err)
{
puts (strerror (errno));
}
return rc;
}