473,394 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Converting CTime read from a C++ archive file

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)
Nov 16 '05 #1
2 2316
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" <cc@hotmai1.com> wrote in message
news:37*************@individual.net...
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)

Nov 16 '05 #2
You could use MFC and MC++ to read the file. This allows to mix native
and managed code together.

-----------
Ajay Kalra
aj*******@yahoo.com

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Guyon Morée | last post by:
what is the difference? if I open a text file in binary (rb) mode, it doesn't matter... the read() output is the same.
3
by: Kevin | last post by:
Hello: I am trying to find documentation on using the ctime library as I need to be able to instantiate an object to keep track of the time when a certain event occurs. I also need to be able...
1
by: wukexin | last post by:
I write my own class Cfile, I want to know what about implement ctime().Who help me? My use function ctime, I sign it with $$$. my class Cfile: #------------------------ file.h...
2
by: Chris | last post by:
Hello, How can i convert a C++ CTime (4 bytes) into a C# DateTime ? (my CTime is read in a file). Thanks, -- Chris
11
by: aisling.cronin | last post by:
Hi I am using ctime to convert the following string 1144412677847 .... Please could some one to double check if they get the same result as me (The Time is Sun Nov 02 09:11:51 2031). It seems...
9
by: flebber | last post by:
I was working at creating a simple program that would read the content of a playlist file( in this case *.k3b") and write it out . the compressed "*.k3b" file has two file and the one I was trying...
1
by: raja11112222 | last post by:
Hi, I have the string as 2007 06 28 16 55 13 206 This string has year month date hour min sec and 206 is millisec My problem is i want to convert this whole string to Ctime of 12Hours
4
by: Pietro Cerutti | last post by:
Hi group, #include <stdio.h> #include <unistd.h> #include <time.h> int main(void) { time_t t1, t2; char *st1, *st2;
9
by: Lars Uffmann | last post by:
Is the ctime library really that poorly designed, or is it just me looking to do things the wrong way? The whole concept of the struct tm seems way too highlevel for my taste - this is something...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.