==============================ModuleG===================================== | | | The program examples' source codes have been arranged in the same | | order that appeared in the Tutorial. This is unedited and unverified | | compilation. Published as is basis for educational, reacretional and | | brain teaser purposes. All trademarks, copyrights and IPs, wherever | | exist, are the sole property of their respective owner and/or | | holder. Any damage or loss by using the materials presented in this | | tutorial is USER responsibility. Part or full distribution, | | reproduction and modification is granted to any body. | | Copyright 2003-2005 © Tenouk, Inc. All rights reserved. | | Distributed through http://www.tenouk.com | | | | | =========================================================================== Compiled using VC++/VC++ .Net.....unmanaged... /* Sets the current locale to "Italian" and "French" using the * setlocale() function. */ #include #include #include int main() { time_t ltime; struct tm *testime; unsigned char locstr[100]; /* Set the locale to Italian */ setlocale(LC_ALL, "italian"); time(<ime); testime = gmtime(<ime); /* %#x is the long date representation, appropriate to the current locale */ if(!strftime((char *)locstr, 100, "%#x", (const struct tm *)testime)) printf("strftime failed!\n"); else printf("In Italian locale, strftime returns \"%s\"\n", locstr); /* Set the locale to French */ setlocale(LC_ALL, "french"); time(<ime); testime = gmtime(<ime); /* %#x is the long date representation, appropriate to the current locale */ if(!strftime((char *)locstr, 100, "%#x", (const struct tm *)testime)) printf("strftime failed!\n"); else printf("In French locale, strftime returns \"%s\"\n", locstr); /* Set the locale back to the default environment */ setlocale(LC_ALL, "C"); time(<ime); testime = gmtime(<ime); printf("Back to default...\n"); if(!strftime((char *)locstr, 100, "%#x", (const struct tm *)testime)) printf("strftime failed!\n"); else printf("In 'C' locale, strftime returns \"%s\"\n", locstr); return 0; } ==============================================================================================