native win32 console application

i want to insert date in native win 32 console application ..is their any date function present in it?if it then tell me method to use to make atrial version .and how to make programm working with date if date expire then how to p4revent programm from working? plzzz help me
#include <time.h>
Hash functions

Need more details?
Last edited on
yes
is it for visual c++2008 win32 console application"?
plzzz tell a example
Last edited on
Sorry, I prefer SYSTEMTIME to "time" functions.

How to get current time :

#include <windows.h>

SYSTEMTIME tm;

GetLocalTime(&tm);
printf("Date: %02d.%02d.%d, %02d:%02d:%02d\n", tm.wDay, tm.wMonth, tm.wYear, tm.wHour, tm.wMinute, tm.wSecond);


If anyone ran the program (Make sure this is the first time), then you'll need to get the time data then store results into a file. (ReadFile Windows API is recommended)

Continue...
Last edited on
this doesnt work on native win32 console application......i needd date works on visual c++ native win32 console application
Tell us more...
- Name?
- Description?
- Time data?
- Special functions?

Hope this helps.
i want to make a trial version..i made a chemistry priodic table program in win 32 console application .input is atomic number and out put it tell name of that element..so i want to make its trial version...which works till a specific date after this program not work
this doesnt work on native win32 console application......i needd date works on visual c++ native win32 console application


Why it didn't work?
i dont know...but whts problem. how to declare date in visual c++ native win32 console application?
Continue...

Console program or Windows API?
My SystemTime code above didn't work?
console programm
Then

#include <windows.h>
//////////////////////////////////////////////////////////////////////
SYSTEMTIME tm;

GetLocalTime(&tm);
printf("Date: %02d.%02d.%d, %02d:%02d:%02d\n", tm.wDay, tm.wMonth, tm.wYear, tm.wHour, tm.wMinute, tm.wSecond);

Did it work?
ye it tells time and date ...but how it works will u tell me?and why we use printf instead of cout?
Last edited on

#include <windows.h>
System_Log(char * szLogFile,const char *szFormat, ...)
{
FILE *hf = NULL;
va_list ap;

if(!szLogFile[0]) return;

hf = fopen(szLogFile, "a");
if(!hf) return;

va_start(ap, szFormat);
vfprintf(hf, szFormat, ap);
va_end(ap);

fprintf(hf, "\n");

fclose(hf);
}

Try this :



//////////////////////////////////////////////////////////////////////
SYSTEMTIME tm;

GetLocalTime(&tm);
System_Log("log.log","Date: %02d.%02d.%d, %02d:%02d:%02d\n", tm.wDay, tm.wMonth, tm.wYear, tm.wHour, tm.wMinute, tm.wSecond);


Then open your log file...
Last edited on
Topic archived. No new replies allowed.