For sequence file formats, you often have to go to the
originator if you want gory details of their specification,
but for working purposes,
various software does this already and you can borrow others
methods.
For one set of sequence reformatters, see
ftp://iubio.bio.indiana.edu/molbio/readseq
-- classic/ has some of this information, and c code you can use
-- java/ newer version, see also
http://iubio.bio.indiana.edu/cgi-bin/readseq.cgi?help
For another set, with some more formats, see
ftp://ftp.uk.embnet.org/pub/EMBOSS/
a large package in C, including sequence reformaters and examples
--
-- d.gilbert--bioinformatics--indiana-u--bloomington-in-47405
-- gilbertd at bio.indiana.edu