I had something similar in production to fix. File had fixed length lines, every column meant something and couldn't change. But it did, suddenly some lines were one char too long, so some columns were invalid. A 2 char field was supposed to be 01, 02, or 03. An int was being used to calculate, and got incremented up to 98, 99, 100, .... More than 2 characters. The program was using C char* with strcpy and strcat, so this field being too long shifted the position of all following fields, bad data! I corrected the field to only be 1, 2 or 3 (zero prepended to make 2 chars), and added checks for the line length before outputting to a the required file. And starting using C++ class std::string instead of char* in my newer code to help my sanity.