111|a1|P01||001|x000
encoding.txt
/n
at the end of both
encoding.txt
and encoding.txt
.
These aren't mentioned in the handout. Are they
supposed to be there? How do I handle this? /n
character after the last line as well.
test1.txt
doesn't have this final new-line
character but it wasn't created using a text editor. This means that you must account for this character when you are reading in the encoding. Notice that this new-line occurs when you are expecting either a "|" and "0" or a "1" character. If you read a new-line character at this point you know you have reached the end of the table.
\0
which is
the character c uses to delimit strings. The binary
representation of \0
is 00000000. \0
(or other non-printable
characters) then you are certain not to need all 256 entries
in your array of ccharacter/code pairs if your sizeof(char) is
1. It's ok if your array is not efficient use of storage. This
isn't the point of this assignment and we don't want you
to spend time thinking about this particular issue.
test1.txt
and encoding2.txt
Please
make sure that you have the current versions which were posted on Monday
morning at 11:50. \n
characters which are typically
understood to represent a carriage return or a new line. Notice that when
you look at the new encoding2.txt file it appears to be missing one of
the characters and takes 2 lines. This is because one of the characters
to be encoded is \n
. If you are confused try looking at
encoding2.txt
using od -bc
.