Im trying to make a LZ78 coder, and when I want to save a string of characters using fwrite, the resulting .txt file is slightly different from the original string.
For instance, the string token_fin contains, as the first 10 characters, the following characters (here with their ASCII value):
24 136 2 217 88 52 134 122 216 24
When I use the next lines:
fwrite(write_file, token_fin, '*char');fclose(write_file);
Then, when I use the next lines to open the file created previosly
read_file = fopen('LZ78_Output.txt','r');labuffer = fread(read_file, '*char');
the first 10 characters are theese:
24 26 2 217 88 52 26 122 216 24
As you can see, characters 136 and 134 are replaced with 26.
Im not sure why this is happening, if anyone can help me I would really apreciate it.
Best Answer