I'm trying to remove the empty lines created when I remove a person from list in a file so my file looks much nicer when is open. this is Code i have to remove the line.

```
std::ifstream ifs("alpha.dat");

  std::ofstream tem("temporary.text");

std::string str((std::istreambuf_iterator<char>(ifs)),
std::istreambuf_iterator<char>());

str.erase(std::remove(str.begin(), str.end(), '\n'), str.end());

cout << str;
tem << str;
tem.close();    
ifs.close();

```

my file content is the following:

```
maria hernandez 1000 h3777 +1000 19:15:19    
rachel dominguez 100000 X8793 +100000 19:15:20                                                  
carlos yatch 20 g6386 +20 19:15:20 

Empty line

carlos Domingues 20 g3336 +20 19:15:20                                                                                                                
Empty Line

```

but What I'm getting on the file is the current:

```
maria hernandez 1000 h3777 +1000 19:15:19 rachel dominguez 100000 X8793 +100000 19:15:20 carlos yatch 20 g6386 +20 19:15:20 

```