minboymike wrote:
Hello,
The DateTime object i am speaking about is found under .NET.
Here is a link:
http://msdn.microsoft.com/library/de...classtopic.asp
Basically, as I said before, I am writing a C program and want to parse
out the day/month/year from this DateTime object, but do not see any
means to do this in C. The time.h library uses time_t object/struct,
but when converting, there is a tyep-mismatch (obviously), causing the
time_t object i created to be set to deafult (1/1/1970).
If you're looking to read the binary representation of this (i.e. you
are given a pointer to it), then you really need to know how .NET
stores it. Knowing that, you can construct a C `struct` that matches,
and read it out, or you could just walk through it byte by byte and
reconstruct the fields. This is going to be very non-portable, not
least for the possibility that the raw binary representation in .NET
may change.
You may be better off writing the fields of interest (maybe all) into a
text file, or some file of known, and well defined type, from your .NET
code, and read it out from your C code. For "file" you may substitute
memory buffer as well. NB, I'm suggesting that you design and document
the exchange format used, so it's under your control.
--
BR, Vladimir