I want to show current date and time in my c++ program. I did this simply by these lines of code:
char date[9], time[9];
_strdate( date );
_strtime( time );
cout << "Current date and time: " << date << " " << time << endl;
This perfectly worked in MS Visual C++ 2010 and Dev C++ 4.9.9.2. But this doesn’t work in Xcode! It says that I’m using undeclared identifiers ‘strdate’ and ‘strtime’. I have included iostream and ctime libraries, but this didn’t help. What’s the problem? Thanks in advance.
As said before, there is no such function in standard c/c++ library.
You can use this alternative. Code is based on some info found on the Internet. I didn’t compile it.