Sindbad~EG File Manager
/* M. Beeson, for Mathpert. Get a string representing the date
in any supported language.
*/
/* Original date 9.21.95
last modified 1.29.98
9.6.04 replaced itoa with sprintf
*/
#include <string.h>
#include <time.h>
#include <stdio.h> /* sprintf */
#define NATLANG_DLL
#include "export.h"
#include "english.h"
#include "natlang.h"
/*______________________________________________________________*/
MEXPORT_NATLANG void EXPORT datestring(char *buffer, int language)
/* Fill buffer with a string like "September 2, 1995"
for today's date. If language is anything but
ENGLISH, use the format 2 September, 1995, and the
month name in the correct language. */
{ time_t timer;
char daybuf[40];
struct tm *tblock;
timer = time(NULL);
tblock = localtime(&timer);
sprintf(daybuf,"%d",tblock->tm_mday); /* day of the month */
if(language != ENGLISH)
{ strcpy(buffer, daybuf);
strcat(buffer, " ");
}
else
strcpy(buffer, ""); /* make sure it begins with null char */
strcat(buffer, monthname(tblock->tm_mon));
strcat(buffer, " ");
if(language == ENGLISH)
{ strcat(buffer, daybuf);
strcat(buffer, ", ");
}
sprintf(buffer + strlen(buffer), "%d", 1900 + tblock->tm_year);
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists