Homwork 1 here is an example of an input file and an output file. Note that the length of the payload is 3 bytes, the payload bytes are
AB CD 01 their exor is 67 frame is error-free
here are the test cases for hw1
Here is an example input file. It contains the code ABC, the name MOKHTAR and the integer 24.
Not that 24 (20 decimal) is not the digit 2 followed by the digit 4. It is the way the computer store integers in the memory.
Take a look at the file using od -c and you will see how every byte is displayed.
In order to read an integer, you have to read a number of bytes equal to the length on integer (4) and sote it in a location where the computer will interppret it as the integer number 24. the tared test casses and the datafile
here is another file that contains 2 records the two records are
ABC MOKHTAR 20 and
XYZ ABOELAZE 30
A file with records with KEY, name, mark1 and mark2 is here
its contents as follows:
ABC MOKHTAR 20 21
XYZ ABOELAZE 22 23
Not ethat both records ends with \0 \0 \0. That is because the integer is stored in 4 bytes, however the values that I have here is small and can fit in only one byte. The other three contains 0's which is the definition of \0 here is manother file which is similar to the previou sone but I changed the 23 to 10987.
Not that the last 4 bytes are 353 * \0 0\
10987 in binary is 00000000000000000010101011101011
Now when you do od on this the resul is
00000000 00000000 00101010 11101011
tha is 0(\0) another 0 (\0) then 00101010 whic is ASCII '*" finally 11101011 is octal 353. In the memory it is stored as 353 "*" \0 \0
here is a routing table example an input example, soon an output