Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
#include <stdio.h>
#include <time.h>
#include <direct.h>
#include <errno.h>
extern int errno;
int main(int, char*)
{
time_t t;
time(&t);
tm* ptm = localtime(&t);
char sz[100];
sprintf(sz, "%2.2d-%2.2d", ptm->tm_mon + 1, ptm->tm_year);
int nRet = mkdir(sz);
if (nRet == 0)
puts("Created successfully.");
else
if (errno == EEXIST)
puts("Already exists!");
return nRet;
}