got it working fully with c++ files reading from stdin