Is there a way to make flex treat NULL like a regular character? ================================================================ Yes, '\0' and '\x00' should both do the trick. Perhaps you have an ancient version of 'flex'. The latest release is version 2.6.4.