If you want OS independence use the C runtime library.
This should work for UNIX, Windows, and DOS going back several revs.
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
.
.
.
struct _stat s;
if ( 0 == _stat( "c:\\somepath\\somefile.ext", &s ) ) {
/* the...
anand102,
In case you're not trying to implement 'substr' as some sort of training assignment:
The C run-time library has a function that does this for you - strstr.
Regards
There's a bunch of ways of doing this (e.g., mktime). This is a fairly straightforward method:
struct tm *ptm;
time_t t;
time(&t); // get current time
t -= 9 * 24 * 60 * 60; // subtract 9 days from now
ptm = localtime(&t); // convert to struct tm
This is what I use. Don't forget to free the returned
TCHAR* when you're done with him.
TCHAR* GetTCHAR(BSTR str)
{
UINT uiLen;
TCHAR* s;
uiLen = SysStringLen(str);
s = (TCHAR*)calloc(uiLen+1,sizeof(TCHAR));
if(s)
{
if(str)
{
#ifdef UNICODE...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.