here is the structures for date, time and attribute
suppose that there are the date( 2 bytes ), time( 2 bytes ) and attribute( 1 byte ) stored somewhere inside array of buffer.
here is the attribute:
Flags in the Attribute byte
7 6 5 4 3 2 1 0
Reserved A D V S H R 0000h
here is the time:
The field is in the special format described below:
Time Format
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Hours (0-23) Minutes (0-59) Seconds (0-29) 0000h
Seconds are counted with 2 seconds interval, so a value of 29 in this field gives 58 seconds.
here is the date:
The field is in the special format described below:
Date Format
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Years from 1980 Month of year (1-12) Day of month (1-31) 0000h
any one know how to use bit fileds?
my question is how do i get the date( 2 bytes ), time( 2 bytes ) and attribute( 1 byte ), because they have different length of bits
i mean each data that i want in these three structures.
or is there any othere way to these three things
PLzzz help me out
if u need more info, plz post here.
Code:
typedef struct
{
unsigned two_secs : 5; /* low 5 bits: 2-second increments */
unsigned minutes : 6; /* middle 6 bits: minutes */
unsigned hours : 5; /* high 5 bits: hours (0-23) */
}DosTime; /* 2 bytes total */
typedef struct
{
unsigned date : 5; /* low 5 bits: date (1-31) */
unsigned month : 4; /* middle 4 bits: month (1-12) */
unsigned year : 7; /* high 7 bits: year - 1980 */
}DosDate; /* 2 bytes total */
typedef struct
{
unsigned int read_only : 1; /* b0 */
unsigned int hidden : 1;
unsigned int system : 1;
unsigned int volume_label : 1;
unsigned int directory : 1;
unsigned int archive : 1;
unsigned int reserved : 2; /* b6, b7 */
}Attrib;