In: Computer Science
C++ question: When cleaning a file the existing data is often read by character. Once a file has been cleaned it is rarely read in by character. Explain Why?
When cleaning a file, special characters need to be removed.
To remove such characters, it is needed to go through all the characters which individually dont have any meaning.
Below are two sentences. It can be observed that some of letters are not usual alphabets, they are a bit different from normal english alphabets. They occur individually as characters. It is needed to access each of them and put a replacement normal character there. like "ē" can be replaced by "e" for the requirement. it may be needed to remove "৷" these symbols and put " "(space there). Characters are stored as 1 byte or more bytes encoding. These 1 byte or more bytes represent different symbols as per encoding. That's why character access is important for cleaning a file.
adhiyajñaḥ kathaṅ kō.tra dēhē.sminmadhusūdana.
prayāṇakālē ca kathaṅ jñēyō.si niyatātmabhiḥ৷৷8.2৷৷
But normally when a file is read, characters individually don't make sense. Even if the file contains numbers, 34 is different than individual 3 and 4. reading character can be used for other purposes but generally words or sentences are required to be read from a file.