change C to C++, check file size, add cfg file