I need to translate this code into c++ (microsoft c++ ATL/MFC)project.
var ticks = System.DateTime.Now.Ticks;
byte[] c = BitConverter.GetBytes(ticks);
byte[] buffer = new byte[c.Length];
for (int i = 0; i < buffer.Length; i++)
buffer[i] = (byte)c[i];
-
What is corresponding call in c++ for System.dateTime.Now.Ticks?
-
What is corresponding Bitconverter in c++.
Note: Boost is not an option in this project.
GetTickCount() may work as an equivalent:
http://msdn.microsoft.com/en-us/library/ms724408%28VS.85%29.aspx
It returns a value of 32 bits (DWORD), so the buffer would be of size = 4 bytes.
Regarding bitconverter, you don’t need it, since C++ can cast the pointer directly: