Oldman, your code has several errors and problems - did you compile and run it?
using namespace std;
int main ()
char filename; /*Better use std::string,
at least 256 characters should be allowed anyway */
if (MyFile.good());/*because of the semicolon!
the following block is always executed.
Why don't you do anything if the file couldn't be opened? */
while (!MyFile.eof()) //bad way to control input loop
string ws_left, word; //whitespace
/*What do you expect to happen here?
This will just skip some words?*/
//why not open the file once outside the loop?
ofstream out("output.txt",ios::out |ios::app);
out.close(); //out is out of scope here
cin.get(); //Won't stop because the input buffer has a leftover endline