include <iostream.h>
#include <fstream.h>
#include <vector>using namespace std;   // 打开std名字空间。 ofstream 声明在std里void main()
{
ofstream outfile("xx.txt",ios_base::app );
}

解决方案 »

  1.   

    #include <iostream.h>
    #include <fstream.h>
    #include <vector>//using namespace std;   // 打开std名字空间。 ofstream 声明在std里void main()
    {
        ofstream outfile("d:\\xx.txt",ios::out );
    outfile<<"china\n";
    cout<<"finish\n";

    //这是可以运行的程序!~~~~~~不知道那为仁兄需要什么样的效果
    //名字空间在里我没有见过怎么用~~~`也不知道怎么用(也不知道VC支持不支持名字空间)~~~~不过在java ,c#中都有名字空间的概念,不过我还没有接触过她如何使用~~~~~
      

  2.   

    改成这样子:
    #include <iostream>
    #include <fstream>
    #include <vector>using namespace std;   // 打开std名字空间。 ofstream 声明在std里void main()
    {
        ofstream outfile("d:\\xx.txt",ios::out );
        outfile<<"china\n";
        cout<<"finish\n";

      

  3.   

    vc当然支持名字空间了,不然ATL&STL怎么用啊?
      

  4.   

    再舉手發言!!::)我想問為什麼要加那一句的? 我好像只在ADO連接數據的小程序中看過NAMESPACE這個東東是什麼來的?在哪規定要加的?我不問的話,我以後不知道當引用什麼頭文件時才要加那句話哦請再勞駕各位了~~:)
      

  5.   

    jeffchen(Jeff) ,我已經改成了你的代碼,但出現以下錯誤:(~--------------------Configuration: VC_TEST_ARRAY_1 - Win32 Debug--------------------
    Compiling...
    VC_TEST_ARRAY_1.cpp
    C:\TEST\VC_TEST_ARRAY_1.cpp(18) : error C2872: 'ofstream' : ambiguous symbol
    Error executing cl.exe.VC_TEST_ARRAY_1.exe - 1 error(s), 0 warning(s)