TAPs 0.7.7.3
TAPsUsefulFns.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsUsefulFns.hpp
00003 
00004 Contains useful functions (global scope in TAPs::Fn namespace).
00005 
00006 SUKITTI PUNAK   (08/24/2006)
00007 UPDATE          (08/24/2006)
00008 ******************************************************************************/
00009 #include "TAPsUsefulFns.hpp"
00010 // Using Inclusion Model (i.e. definitions are included in declarations)
00011 //                       (this name.cpp is included in name.hpp)
00012 // Each friend is defined directly inside its declaration.
00013 
00014 BEGIN_NAMESPACE_TAPs__Fn
00015 //=============================================================================
00016 //-----------------------------------------------------------------------------
00017 void UsefulFn::ChangeFileNameExtension ( 
00018         char *          newFileName,        // O/P
00019         const char *    currentFileName,    // I/P
00020         const char *    newExtension        // I/P
00021 )
00022 {
00023     //---------------------------------------------------------------
00024     // Change the format of the file to a new extension
00025     char filename[128];
00026     strcpy( filename, currentFileName );
00027     char * token0 = strtok( filename, "." );
00028     char * token1 = strtok( '\0', "." );
00029     strcpy( newFileName, token0 );
00030     while ( token1 ) {
00031         token0 = token1;
00032         std::cout << token0 << std::endl;
00033         token1 = strtok( '\0', "." );
00034         strcat( newFileName, "." );
00035         if ( token1 ) {
00036             strcat( newFileName, token0 );
00037         }
00038         else {
00039             strcat( newFileName, newExtension );
00040         }
00041     }
00042 }
00043 //-----------------------------------------------------------------------------
00044 //=============================================================================
00045 END_NAMESPACE_TAPs__Fn
00046 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00047 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines