I am reading in from a file and writing it to another file without white spaces. All i need to figure out is how to remove spaces. For instance,
INPUT:Hello how are you
OUTPUT:Hellohowareyou
This site will help with modifying the strings: http://www.cplusplus.com/reference/string/string/
Theirs 2 easy ways of doing this both similar. 1. Use find and look for spaces and when you find the position of a space erase it. Put this in a loop that looks for and removes spaces till it runs through the entire string without finding any spaces. 2. Access it as you would an array. stringName[] and look for spaces that way and remove them.
> I am reading in from a file and writing it to another file without white spaces.
> All i need to figure out is how to remove spaces.
By default, formatted input skips white space. So, you don't have to do anything more than:
read characters from the input stream with >> and write out the characters that were read to the output stream.
1 2 3
// copy infile to outfile without white spaces
char c ;
while( infile >> c ) outfile << c ;