Segmentation fault in fprintf fixed. Errors in C generating fixed.