Okay there, i have some code in python that opens a file -> process it -> and writes data to other file.
def ELECrypt(myFile, outFile, code):
Code = list(bytes(code,'utf-8'))
with open(myFile, 'rb') as bFil:
with open(outFile, 'wb') as bOutFil:
while True :
data = bytearray(bFil.read(CHUNK_SIZE))
if not data: break
processIt(data, Code)
bOutFil.write(data)
It works fine, but it is too slow. So, i wrote a C++ program that does similar thing and I want to know if it is possible to make it callable from python
#include <iostream>
#include <fstream>
using namespace std;
int CHUNK_SIZE = 1*1024*1024;
void ELECrypt(ifstream& myFile, ofstream& outFile, unsigned char Code[], int CodeLen){
unsigned char* fChunk = new unsigned char[CHUNK_SIZE];
int readCount;
while (myFile.read((char *)fChunk, CHUNK_SIZE) || myFile.gcount() > 0)
{
...Processing a data block
outFile.write((char *)fChunk, myFile.gcount());
}
delete [] fChunk;
}
Yeah-yeah, I know there might be a lot of work, but i can`t even find where to read about arguments that can be passed by python to c++ extension