Convert little-endian to big-endian and 32-bit to 64-bit


Question Description

I have this question as homework and I can't seem to figure it out. Hope someone can help me out.

The next 20 bytes represent the content of the bytes of a binary file written by a 32-bits big-endian computer (the left colums represents the byte-indices, the other columns represent the content of the bytes; letters are ascii-characters, numbers are numerical byte-values). The bytes at addresses 16-19 should by interpreted as a 32-bits value.

0000     h e l l o 32 w o

0008     r l d 0 0 0  0 0

0016     0 0 4 3

(The 32 at address 5 is one value).

Someone writes a program that reads the text stored in the first 16 bytes and the binary value stored in the next 4 bytes.

-What's the numerical value (decimal or hexadecimal value is OK) stored in the bytes on addresses 16-19 (so 1 numerical value, not 4 values)

-Edit the file so that a 64-bits little endian computer will read the same text and the same value. Because the little endian computer has a 64-bits architecture, the value should not only be converted to a little-endian architecture, but also to a 64-bits architecture.

Hope someone can help me out! Thanks very much in advance!

This question has not been answered.

Create a free account to get help with this and any other question!

Similar Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors