Question

In: Computer Science

C++ question: When cleaning a file the existing data is often read by character. Once a...

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?

Solutions

Expert Solution

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.


Related Solutions

Create a c file to read from an existing file one character at a time and...
Create a c file to read from an existing file one character at a time and print that character to the console Create a c file to read a character from the standard input and write it to a file. please help me
language c++(Data structure) You have to read a file and store a data in character array...
language c++(Data structure) You have to read a file and store a data in character array ( you cant initialize a character array, you have to code generically) code must be generic u must read a file onece u cant use built in function etc string, code in classes if u initialized a char array or ur code doesn't run i will dislike and report u you can use link list to store data
C++ Question 2 You will read in data about the planets from a text file, and...
C++ Question 2 You will read in data about the planets from a text file, and then print out the data about that planet when the user requests the data. You will need to create a Planet Class (since this assignment does not cover templates, you are expected to split your class into .cpp and .h files), as well as a .cpp/.h library with the functions described below Planet Class For the first phase of the question, you will create...
Done in c++, Read an unsorted keywords file once to determine how many words are in...
Done in c++, Read an unsorted keywords file once to determine how many words are in the file. Allocate memory dynamically to store the unsorted keywords in an array of strings or an array of c-strings. (Hint: be sure to clear your input file stream before re-reading the file) Reread the keywords file a second time and store the words in the dynamically allocated array of strings or c-strings Sort the array of key words. (Hint: be sure to check...
Read an unsorted keywords file once to determine how many words are in the file. Allocate...
Read an unsorted keywords file once to determine how many words are in the file. Allocate memory dynamically to store the unsorted keywords in an array of strings or an array of c-strings. (Hint: be sure to clear your input file stream before re-reading the file) Reread the keywords file a second time and store the words in the dynamically allocated array of strings or c-strings Sort the array of key words. (Hint: be sure to check your sorted array...
Read an unsorted keywords file once to determine how many words are in the file. Allocate...
Read an unsorted keywords file once to determine how many words are in the file. Allocate memory dynamically to store the unsorted keywords in an array of strings or an array of c-strings. (Hint: be sure to clear your input file stream before re-reading the file) Reread the keywords file a second time and store the words in the dynamically allocated array of strings or c-strings Sort the array of key words. (Hint: be sure to check your sorted array...
Write a C++ program to read characters from the keyboard until a '#' character is read....
Write a C++ program to read characters from the keyboard until a '#' character is read. Then the program will find and print the number of uppercase letters read from the keyboard.
Write a C++ program to read a data file containing the velocity of cars crossing an...
Write a C++ program to read a data file containing the velocity of cars crossing an intersection. Then determine the average velocity and the standard deviation of this data set. Use the concept of vector array to store the data and perform the calculations. Include a function called “Standard” to perform the standard deviation calculations and then return the value to the main function for printing. Data to use. 10,15,20,25,30,35,40,45,50,55. Please use something basic.
I have a C problem. I need to read the data of a txt file to...
I have a C problem. I need to read the data of a txt file to array by struct, then use these data to sum or sort. The txt file and the struct like aa.txt 1 2 3 4 ***************************** struct aaa{ int num1,num2; }bbb[2]; num1 for 1,3, num2 for 2 4 I made a void readfile () function for read data. How can I pass the numbers to another function ( void sum () and void sort() ) for...
HW_6c - Append data to existing data in a file. Include the following in the main.cpp...
HW_6c - Append data to existing data in a file. Include the following in the main.cpp file. Prompt the user to enter 3 more numbers, then read the numbers and write them to             the results.txt file. Include code so that when the data is written to file, it is appended (added on to the     end of the existing data). Open the results.txt file and verify that the file was written successfully. /* OUTPUT Here are the numbers...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT