Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

GlobalFuncs.h

Go to the documentation of this file.
00001 #ifndef _GlobalFuncs_h
00002 #define _GlobalFuncs_h
00003 
00004 #include <time.h>       // localtime(), time()
00005 #include <stdio.h>      // sprintf()
00006 
00007 #include <string>
00008 #include <algorithm>// transform().
00009 #include <ctype.h>      // tolower(), toupper().
00010 
00011 using std::string;
00012 using std::transform;
00013 
00015 static void GetCurrentDate(char *cDay, char *cMonth, char *cYear)
00016 {
00017     time_t rawtime;
00018         struct tm* timeinfo;
00019                 
00020         time(&rawtime);
00021         timeinfo        = localtime(&rawtime);
00022         int iday        = timeinfo->tm_mday;
00023         int imonth      = timeinfo->tm_mon + 1;
00024 
00025         //**********************************
00026         // Put day & month in 2 char format.
00027         //**********************************
00028         if( iday < 10 ) // For day.
00029                 sprintf(cDay, "0%i",iday);
00030         else
00031                 sprintf(cDay, "%i",iday);
00032 
00033         if(imonth < 10) // For month.
00034                 sprintf(cMonth, "0%i",imonth);
00035         else
00036                 sprintf(cMonth, "%i",imonth);
00037         
00038         // For year.
00039         sprintf(cYear, "%i",timeinfo->tm_year + 1900);
00040 }
00041 
00042 
00043 static void UpperCase(string &rstr)
00044 {
00045         transform(rstr.begin(), rstr.end(),     // Source
00046                           rstr.begin(),                         // Destination
00047                           toupper);                                     // Operation
00048 }
00049 /*
00050 static void LowerCase(string &rstr)
00051 {
00052         transform(rstr.begin(), rstr.end(),     // Source
00053                           rstr.begin(),                         // Destination
00054                           tolower);                                     // Operation
00055 }
00056 */
00057 
00058 #endif // _GlobalFuncs_h

Generated on Wed Feb 25 01:15:11 2004 for eDonkeyFilesManager by doxygen 1.3.2