Results 1 to 8 of 8
Hi all,
This my problem , i'm comparing hex values....
main(){
:::::
:::::
if(header[0]==0x47 && header[1]==0x49 && header[2]==0x46 && header[3]==0x38 )
printf("it's gif file");
:::
::
}
----
The program ...
- 04-02-2007 #1
Hex comparision
Hi all,
This my problem , i'm comparing hex values....
main(){
:::::
:::::
if(header[0]==0x47 && header[1]==0x49 && header[2]==0x46 && header[3]==0x38 )
printf("it's gif file");
:::
::
}
----
The program works fine....
i want to know....
is the following is same as above one-i just appended ffffff ?
please provide some info. regarding the usage of ffffff.
if(header[0]==0xffffff47 && header[1]==0xffffff49 && header[2]==0xffffff46 && header[3]==0xffffff38 )
----------------
Thanks guyz.- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 04-02-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
0x47 is not equal to 0xffffff47, try this:
RegardsCode:printf("%d ; %d\n", 0x47, 0xffffff47);
- 04-03-2007 #3
i should have tried this before posting here,
if(0xffffff47==0x47 )
printf("equal");
else
printf("nooooo");
---
output:
nooooo- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 04-03-2007 #4Linux User
- Join Date
- Oct 2004
- Location
- /dev/random
- Posts
- 404
I think we have already discussed this here. Especially, the way you're trying to compare the GIF header doesn't look nice - I have already explained how standard headers should be compared for signatures.
Moreover, as for the 0xffffff prefix,So logically concluding,Code:0xf = 15 = 1111 0xff = 255 = 1111 1111
which is not the same asCode:0xffffff47 = 1111 1111 1111 1111 1111 1111 0100 0111
HTHCode:0x47 = 0x00000047 = 0000 0000 0000 0000 0000 0000 0100 0111
The Unforgiven
Registered Linux User #358564
- 04-03-2007 #5
f in hex is: 15 in decimal, 1111 in binary, 17 in octal. Are you a student or teaching yourself?
- 04-04-2007 #6
I was expecting reply from you
Originally Posted by the_unforgiven
Yes...you already explained me about how header are compared...
creating structures for the header and proceed from there.
But i'm in search of many file formats ( gif,jpeg,....) -
so trying to fetch file types with help of headers only
and not declaring specific structure of gif or jepg.because declaring structure for each file type is itself occupies space.
How should i proceed?- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 04-04-2007 #7
....
Originally Posted by likwid
i'm always a student
- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 04-04-2007 #8
Well I was gonna say maybe your instructor should have taken more time to explain the math behind it to you.. some professors are just weak. I had this one who was a mathematician, and he told us that couldn't figure how to set unix permissions in octal.


Reply With Quote