Code:
ofstream a_file ( "example.txt" );
Try specifying the location.