Path: utzoo!mnetor!uunet!husc6!bloom-beacon!mit-eddie!uw-beaver!cornell!rochester!srs!craig From: craig@srs.UUCP (Craig Schmackpfeffer) Newsgroups: comp.lang.c Subject: Re: Automatic Filename Extensions Message-ID: <787@srs.UUCP> Date: 11 Apr 88 12:27:22 GMT References: <12901@brl-adm.ARPA> Reply-To: srs!craig@cs.rochester.edu (Craig Schmackpfeffer) Organization: S.R. Systems, Rochester NY Lines: 22 In article <12901@brl-adm.ARPA> C04661DC%WUVMD.BITNET@CUNYVM.CUNY.EDU (David Camp) writes: > > A programming technique I have frequently used is: > >if (strchr (filename, '.') == NULL) > strcat (filename, ".EXT"); >-David- Here at SR, we have many signal processing programs which are able to contort signals into just about any new format. We have adopted "." suffixes (which can be supplied on the command line) to help organize this mess. The big problem occurs when you try to do > 1 extension. Our solution was to write an add_extension(fname, extension) function. If extension is not empty (or not NULL), fname is truncated after the last '.' and extension is appended. It works very nicely. Craig -- Craig Schmackpfeffer @ S.R. Systems {allegra,rutgers,ames}!rochester!srs!craig