That's a neat technique, thanks for posting.
Quite a common requirement seems to be reading the first n characters, or the first row, of a text file to determine its type/layout before directing to the appropriate dataflow - I reckon you're well on the way to cracking that with this.
Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this
If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.
Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.