I have a program that is expected to compress an ASCII file by taking advantage of the fact that the MSB of each byte in a text file is 0, because ASCII codes go no higher than 127. I read in an ASCII file with fscanf(...), and store all of the characters in a character pointer. It then sends this char pointer to the compressBytes function, which does the necessary bit operations, and then sends back the appropriate char pointer representing what is to be printed. The new char pointer is printed to another file using the write(...) function. The problem is that in some special cases the character to be printed to the compressed file is ASCII 10, or line feed. When this character occurs, the write function prints two bytes at the same time: ASCII 13 followed by ASCII 10. How can i get my write(...) function to only print one byte, ASCII 10 in this case?
Thanks for the help.