PC Review


Reply
Thread Tools Rate Thread

Converting CTime read from a C++ archive file

 
 
Claire
Guest
Posts: n/a
 
      15th Feb 2005
I need to interface to an MFC CArchive file created with Visual Studio 6.
I've found some online sample code to translate an archived string into C#
I now need to read in and translate a CTime object. This is written to the
file as 4 bytes. Can anyone tell me the structure please


(It's a shame that Microsoft don't publish information on CArchive formats
in support for conversion to the dotnet framework)


 
Reply With Quote
 
 
 
 
Magnus Krisell
Guest
Posts: n/a
 
      15th Feb 2005
The CTime object is probably written as a (32-bit) time_t value that is
the number of seconds since Jan 1, 1970.

Thus, assuming reader is a BinaryReader instance, try the following code:

int seconds = reader.ReadInt32();
DateTime date = new DateTime(1970, 1, 1);
TimeSpan span = new TimeSpan(0, 0, 0, seconds);
date += span;

"Claire" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I need to interface to an MFC CArchive file created with Visual Studio 6.
>I've found some online sample code to translate an archived string into C#
> I now need to read in and translate a CTime object. This is written to the
> file as 4 bytes. Can anyone tell me the structure please
>
>
> (It's a shame that Microsoft don't publish information on CArchive formats
> in support for conversion to the dotnet framework)
>



 
Reply With Quote
 
Ajay Kalra
Guest
Posts: n/a
 
      15th Feb 2005
You could use MFC and MC++ to read the file. This allows to mix native
and managed code together.

-----------
Ajay Kalra
(E-Mail Removed)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File Attributes Have Changed to Read Only, Archive, or Hidden! Roland Windows XP Configuration 0 24th Mar 2008 11:41 PM
How Can I Make an Archive File "Read Only"? StonyCreeker Microsoft Outlook Discussion 4 30th Jan 2008 06:23 PM
Outlook 2007 Auto Archive - Cannot read archive properties from fo Deputy5211 Microsoft Outlook 2 23rd Jan 2008 06:05 AM
How to read blank space while converting a CSV file to a Datatable. Sandeep Singh Microsoft Dot NET Framework 0 9th Jan 2008 05:28 PM
Converting AOL email archive file to an Outlook 2003 compatible file J.S. Microsoft Outlook Discussion 2 12th Dec 2006 11:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:32 AM.