单项选择题

以下程序企图把从键盘终端输入的字符输出到名为abc.txt的文件中,当从终端读到字符’#’时,结束输入和输出操作。但该程序有错。
#include <iostream>
#include <fstream>
using namespace std;
int main()

ofstream ofile; char ch;
ofile.open("d:\\abc.txt", ’W’);
do
cin>>ch;
ofile.put(ch);
while(ch!=’#’);
ofile.close();
return 0;

程序出错的原因是( )。

A.成员函数open调用形式错误
B.输入文件没有关闭
C.成员函数put调用形式错误
D.对象ofile定义错误