UNABLE TO DELETE BLANK SPACES FROM A FILE.

*********************************
Last edited on
I would assume you open the input file and the output file at the same time. I would only loop through the input file one character at a time. There is a function called isspace(char nChar) in the library called cctype. For more information on it you can find it in reference pages of this site. If that function comes back false I would write the character out the the new file. After the loop completed I would close both files. If I needed to check my work I would open the output file up in a text editor to verify. I could post the entire code up if you needed to see it but I am assuming this is homework for a class. If I was doing this line by line this would have a slightly different form and that would be using on the input file std::getline(inputFile, std::string line) then I would loop through each line and do something similar.

Topic archived. No new replies allowed.