Hello Friends
I have a problem date format written as DD/MM/YYYY. Date already save into a file as binary. I don't know which technique should be used. Sample date as following
a. 31/09/2009 in binary in the file written as 4f 75 25 00
b. 31/05/2008 in binary in the file written as 5a 74 25 00
My problem is how the date would be written as above in binary. Also, how encode or decode.
Please help me.
Thanks in advance.
18 9003
What was the format of the data when it was written?
Was it:
int month
int slash
int day
int slash
int year
??
Or was it:
int month
char slash
int day
char slash
int year
Or was it:
char month
char month
char slash
char day
char day
char slash
char year
char year
char year
char year
??
You can't read file when you don't know the format of the data.
the date format DD/MM/YYYY meaning
DD -date
slash (/) - just a separator
MM - month
slash (/) - just a separator
YYYY - year
so, data to be taken for decode or encode is DDMMYYYY only
Thanks
the date format DD/MM/YYYY meaning
DD -date
slash (/) - just a separator
MM - month
slash (/) - just a separator
YYYY - year
so, data to be taken for decode or encode is DDMMYYYY only
Thanks
all data must be in INTEGER example given 31052009
[quote=saykeenar i]
all data must be in INTEGER example given 31052009
[/code]
If you can read 31052009 in the disc file, then you date is a string of char integers.
Further, it means the file is not in binary. If it was, you couldn't read the data directly with your eye.
From what you say, the disc file is in text mode and you need to read the date into a char array. Then you can parse the array and add the slashes.
all data must be in INTEGER example given 31052009
So, must it be integer (32-bit) 30million-something for day 30 or the same 32 bits in unknown format you gave in first post (4f 75 25 00) ?
So, must it be integer (32-bit) 30million-something for day 30 or the same 32 bits in unknown format you gave in first post (4f 75 25 00) ?
Yes, this in unsigned integer and using 32 bits to save the data. So, I am not sure how or technique used to encode or decode or using bitwise operator as mentioned in my first post. So,it is the main problem.
I hope you can understand it
Thank you
Yes, this in unsigned integer and using 32 bits to save the data. So, I am not sure how or technique used to encode or decode or using bitwise operator as mentioned in my first post. So,it is the main problem.
I hope you can understand it
Thank you
I understand, but the data provided ( 2 samples ) is not enough to guess how data is encoded, are there any fields where day month and year are stored independently or is it flat ( days since some date ) number.
It seems however that it is low-endian 'days since ***' format ( as first minus second equals 245, that is number of days in year minus 120 days in four months )
So you need to convert it to 32bit integer, find where is zero point of the scale and go.
I understand, but the data provided ( 2 samples ) is not enough to guess how data is encoded, are there any fields where day month and year are stored independently or is it flat ( days since some date ) number.
It seems however that it is low-endian 'days since ***' format ( as first minus second equals 245, that is number of days in year minus 120 days in four months )
So you need to convert it to 32bit integer, find where is zero point of the scale and go.
Oh , I am forgot that the first date as I mentioned is wrongly typed. The other sample data which same format DDMMYYYY I found as following :
Date : 31012009 written as 4f 75 25 00
Date : 30092009 written as 41 76 25 00
Date : 01122009 written as 7f 76 25 00
Date : 02012010 written as 9f 76 25 00
Date : 30012009 written as 4e 75 25 00
Date : 01012010 written as 9e 76 25 00
So, I am not understand how it got the above. Would you show the calculation to me and to be written in C?
Thank you.
Oh , I am forgot that the first date as I mentioned is wrongly typed. The other sample data which same format DDMMYYYY I found as following :
Date : 31012009 written as 4f 75 25 00
Date : 30092009 written as 41 76 25 00
Date : 01122009 written as 7f 76 25 00
Date : 02012010 written as 9f 76 25 00
Date : 30012009 written as 4e 75 25 00
Date : 01012010 written as 9e 76 25 00
So, I am not understand how it got the above. Would you show the calculation to me and to be written in C?
Thank you.
Do you know how integer numbers are represented in computer?
Open windows calculatorm switch to hex. Enter 25769e( the last number, higher byte is the rightmost), press minus, enter 25754e, press '=', switch to decimal. You get 336, it is exactly a year minus one month, as the second is Dec 1 and the first is Dec 30. So the whole number looks like number of days since some date. If it were bit fields, it probably would have same bits equal if same year/month is equal, that is not this case ( 75-76 transition occurs within the same year ).
To convert it to day, monh and year, you need to find point zero, count leap years correctly (or at least as correct as the program created this format do ) find year, and convert remainder to month and day. I'm not going to do it because *) I have no original program to verify, *)it probably takes more than an hour and *)It is in no way challenging, rewarding or increasing my skills - rather boring and useless, let alone violating Teh Rulz.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Newbie |
last post by:
How would I modify this form
to encode *all* the characters
in the 'source' textarea to the
'%xx' format & place result
code into the 'output' textarea?
(cross browser compatable)
Any help is appreciated.
Regards.
|
by: Damir Hakimov |
last post by:
Hi *!
I found a strange bug in base64.encode and decode, when I try to encode
- decode a file 1728512 bytes lenth.
Is somebody meet with this? I don't attach the file because it big, but
can send to private.
Which solution for transfer file (binary data) via string-only object?
Damir.
|
by: AR |
last post by:
I would like to know more about the Encode/Decode feature available
within MS Access.
This is what I have read from Microsoft Office OnLine:
"The simplest method of protection is to encode the database. Encoding
a database compacts the database file and helps protect it from being
read by a word processor."
Is this recommended as a best practice? What is the impact on
|
by: student |
last post by:
Hi all,
Can any one help me in finding the solution to convert
binary format file (ex: jpeg, bmp) to base64 using vc++
code. any help in this regard would be appreciated.
thanks
|
by: jtfaulk |
last post by:
I need to encode some information on the server side using ASP.NET with
C#; sending via HTTP to a client side application, that needs to be
decoded in an MFC C++ application.
I'm not sure if I can encode something using:
C#: System.Security.Cryptography (to encode)
and
| |
by: flanagak |
last post by:
All,
I was wondering if someone could point me in the right direction to decode the following information.
I am working on a tool writen in C and one of the items in the file I am decoding is a timestamp in this format.
I had started looking at a bitfield structure, but I am wondering if there is a better / more portable solution.
Hex Value in the file: 9D AF 79 C0
Binary breakdown:
1001(9) 1101(D) 1010(A) 1111(F) 0111(7) 1001(9)...
|
by: 7stud |
last post by:
s1 = "hello"
s2 = s1.encode("utf-8")
s1 = "an accented 'e': \xc3\xa9"
s2 = s1.encode("utf-8")
The last line produces the error:
---
Traceback (most recent call last):
|
by: J Peyret |
last post by:
Well, as usual I am confused by unicode encoding errors.
I have a string with problematic characters in it which I'd like to
put into a postgresql table.
That results in a postgresql error so I am trying to fix things with
<string>.encode
he Company�s ticker
Trying for an encode:
|
by: anonymous |
last post by:
1 Objective to write little programs to help me learn German. See code
after numbered comments. //Thanks in advance for any direction or
suggestions.
tk
2 Want keyboard answer input, for example:
answer_str = raw_input(' Enter answer ') Herr Üü
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |