<commit_before>#include <iostream>
#include <fstream>

using namespace std;

void printUsage(char* progName)
{
	cout << endl;
	cout << "Usage: " << endl;
	cout <<  progName << " <fileToTransmit> </dev/yourSerialDevice>";
	cout << endl;
	cout << endl;
}

int main(int argc, char* argv[])
{
	cout << endl << "Transmit64 Copyright 2016 W.A.Jurczyk" << endl << endl;

	if( argc != 3 )
	{
		printUsage(argv[0]);
		return -1;
	}

	ifstream ifs(argv[1], ios_base::in | ios_base::binary);

	if( !ifs )
	{
		cerr << "Error reading file " << argv[1] << endl;
		return -1;
	}

	char currentChar;
	while (ifs.read(&currentChar, 1) )
	{
		cout << currentChar;	
	}

	cout << endl;

	if (ifs.eof())
	{
		cout << "EOF reached." << endl;
	}
	else
	{
		cerr << "Error reading file." << endl;
	}
	return 0;
}<commit_msg>file is being written byte by byte. plus console output<commit_after>#include <iostream>
#include <fstream>
#include <chrono>
#include <thread>

using namespace std;

void printUsage(char* progName)
{
	cout << endl;
	cout << "Usage: " << endl;
	cout <<  progName << " <fileToTransmit> </dev/yourSerialDevice> <delayPerByte>";
	cout << endl;
	cout << endl;
}

void printCharWithBinary(const char& c)
{
	cout << "\"" << c << "\"" << ": ";
	for(int i = 7; i >= 0; --i)
	{
		cout << ((c >> i) & 1);
	}
}

int main(int argc, char* argv[])
{
	cout << endl << "Transmit64 Copyright 2016 W.A.Jurczyk" << endl << endl;

	if( argc != 4 )
	{
		printUsage(argv[0]);
		return -1;
	}

	ifstream ifs(argv[1], ios_base::in | ios_base::binary | ios_base::ate);

	if( !ifs )
	{
		cerr << "Error opening file " << argv[1] << endl;
		return -1;
	}

	int filesize = ifs.tellg();
	ifs.seekg (0, ifs.beg);

	ofstream ofs(argv[2], ios_base::out | ios_base::binary);
	if( !ofs )
	{
		cerr << "Error opening device " << argv[2] << endl;
		return -1;
	}

	int delay = atoi( argv[3] );

	char currentChar;
	int currentPos = 0;
	while (ifs.read(&currentChar, 1) )
	{
		ofs << currentChar;
		//cout << "\r";
		printCharWithBinary(currentChar);
		cout << "; written " << currentPos << "/" << filesize << endl;
		
		currentPos++;
		std::this_thread::sleep_for(std::chrono::milliseconds(delay));
	}

	cout << endl;

	if (ifs.eof())
	{
		cout << "EOF reached." << endl;
	}
	else
	{
		cerr << "Error reading file." << endl;
	}

	ifs.close();
	ofs.close();

	return 0;
}
{'fraction_non_alphanumeric': 0.1961456102783726, 'fraction_numerical': 0.015845824411134905, 'mean_word_length': 3.4665391969407264, 'pattern_counts': {'":': 1, '<': 122, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4693584', 'n_tokens_mistral': 991, 'n_tokens_neox': 919, 'n_words': 228}