Utility to see the file content in HEX Format.

This is a discussion on Utility to see the file content in HEX Format. within the C Programming forums, part of the General Programming Boards category; Dear Friends, Can Any one tell me what is the utility to see the content of file which is in ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    19

    Utility to see the file content in HEX Format.

    Dear Friends,

    Can Any one tell me what is the utility to see the content of file which is in hex format .... [ UNIX platform ]


    with best regards
    Mehul Doshi.

  2. #2
    Registered User
    Join Date
    Jun 2002
    Posts
    19

    Utility !!!

    Dear Friend,

    I have checked some level ..... I am having some more doubt....

    -----
    SAMPLE file --

    0000000 0029 0100 0001 1fa1 8919 0064 0200 ffff
    0000020 ffff 0359 8646 1976 0005 7148 5807 2823
    0000040 0207 4e20 054d 0001 98ff 0200 0359 8646
    0000060 8000 4132 8740 6203 8919 0064 0200 ffff
    0000100 ffff 0101 8900 3148 7899 ffff ffff 04ff
    0000120 4644 3006 3223 94f6 1550 0602 2248 89ff
    0000140 3064 7093 ffff ffff ffff 00ff 1103 1200
    0000160 6501 e300 1927 6489 0000 ff02 ffff 65ff
    0000200 e300 0027 0811 ff00 5138 2353 0728 2002
    -----
    what does the first column represent .....

    also in case there is BCD word also present in the data then how do we identify ....

    is there anything to do with LSB or MSB here ....

    Please Help !!!

    with thanks and regards
    Mehul Doshi

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    19

    Utility !!! - part 2

    my dear friend,


    I am online and looking for various help.... mean while taking help from you. It was a very Fruitful experience here .... I post 3-4 Questions today and I got help for everything a very very satisfactory answer very fast ....

    I have not gave up ... still trying .... Thank You for the kind suggestion.... Looking forward for similar help again ...

    with warm regards
    Mehul Doshi

  4. #4
    Green Member Cshot's Avatar
    Join Date
    Jun 2002
    Posts
    892
    0000000 0029 0100 0001 1fa1 8919 0064 0200 ffff
    0000020 ffff 0359 8646 1976 0005 7148 5807 2823
    0000040 0207 4e20 054d 0001 98ff 0200 0359 8646
    0000060 8000 4132 8740 6203 8919 0064 0200 ffff
    0000100 ffff 0101 8900 3148 7899 ffff ffff 04ff
    0000120 4644 3006 3223 94f6 1550 0602 2248 89ff
    0000140 3064 7093 ffff ffff ffff 00ff 1103 1200
    0000160 6501 e300 1927 6489 0000 ff02 ffff 65ff
    0000200 e300 0027 0811 ff00 5138 2353 0728 2002
    -----
    what does the first column represent .....
    The first column represents the address. For example:
    0029 is at 00000000
    0100 is at 00000004
    0001 is at 00000008
    ...
    ffff is at 0000001c
    ffff is at 00000020

  5. #5
    Sayeh
    Guest
    Code:
    0000000 0029 0100 0001 1fa1 8919 0064 0200 ffff 
    0000020 ffff 0359 8646 1976 0005 7148 5807 2823 
    0000040 0207 4e20 054d 0001 98ff 0200 0359 8646 
    0000060 8000 4132 8740 6203 8919 0064 0200 ffff 
    0000100 ffff 0101 8900 3148 7899 ffff ffff 04ff 
    0000120 4644 3006 3223 94f6 1550 0602 2248 89ff 
    0000140 3064 7093 ffff ffff ffff 00ff 1103 1200 
    0000160 6501 e300 1927 6489 0000 ff02 ffff 65ff 
    0000200 e300 0027 0811 ff00 5138 2353 0728 2002
    The first column is the address from the start of the file. As you can see, at location 0 is 0x00. At location 1 is 0x29. At location 2 is 0x01, and at location 3 is 0x00, and so on.

    All numbers shown are in hex (base 16). As you can see, therefore, 16 bytes are shown across each row (or 8 integers as they are presently arranged).

    MSB and LSB are important depending on processor. Intel processors and motorola processors have the LSB/MSB flipped. That is, on one processor LSB is on the left and on the other processor, it is on the right.

    In the above example, we can tell that LSB is on the right.

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I sense the use of a for loop...

    Code:
    int x, y;
    for( x = 0; ; x += 4 )
    {
        printf("%x ", x );
        if( fread( &y, sizeof(y), 1, fp ) <1 ) break;
        printf("%x ", y );
        if( fread( &y, sizeof(y), 1, fp ) <1 ) break;
        printf("%x ", y );
        if( fread( &y, sizeof(y), 1, fp ) <1 ) break;
        printf("%x ", y );
        if( fread( &y, sizeof(y), 1, fp ) <1 ) break;
        printf("%x\n", y );
    }
    Quzah.
    Hope is the first step on the road to disappointment.

  7. #7
    Registered User
    Join Date
    Jun 2002
    Posts
    19

    BCD !!!

    Dear Friend,


    Refer my previous Post in the same topic. For ur convience I have attached below.

    ---------- sample output
    od -x <file-name> [ here file-name is file containing HEX code]

    0000000 0029 0100 0001 1fa1 8919 0064 0200 ffff
    0000020 ffff 0359 8646 1976 0005 7148 5807 2823
    0000040 0207 4e20 054d 0001 98ff 0200 0359 8646
    0000060 8000 4132 8740 6203 8919 0064 0200 ffff
    0000100 ffff 0101 8900 3148 7899 ffff ffff 04ff
    0000120 4644 3006 3223 94f6 1550 0602 2248 89ff
    0000140 3064 7093 ffff ffff ffff 00ff 1103 1200
    0000160 6501 e300 1927 6489 0000 ff02 ffff 65ff
    0000200 e300 0027 0811 ff00 5138 2353 0728 2002
    --------

    I just wanted to know what does the first column signify. Actual content of the file-name is having the things written in the second column onwards data.

    Also if some one can give me what is the real meaning of BCD word. [ I guess Binary Coded Decimal] As this file-name is containing the bcd code also in between.

    any GOOD link telling about BCD code ... Help !!!

    with best regards
    Mehul Doshi

  8. #8
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Did you read Sayeh's post? He explained what the first column is. Go to www.google.com and search for more information on BCP.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Replies: 5
    Last Post: 06-07-2007, 01:41 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21