//得到文件中的内容
len=fgetc(fp1);
printf("%c",len);int i=0;
temp[i]=....
转化一下

解决方案 »

  1.   

    using namespace std;   不能用??所有关于string的函数都不能用。象strlen()...
      

  2.   

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <iostream.h>
    #include "stdafx.h" 不知道是怎么回事,还是不能用???
      

  3.   

    #include<iostream>
    using namespace std;
      

  4.   

    strlen 来操作 string 对象?
    string 是对象,不是 char*要取string的长度,使用lengthstring s("test");
    size_t nLen = s.length();
      

  5.   

    末尾加".h"的是C风格的头文件,在C里好象没有string,因此只能使用
    #include <iostream>
    #include <string>
    using namespace std;
    这是一种STL格式
      

  6.   

    #include   <stdio.h> 
    #include   <stdlib.h> 
    #include   <string> 
    #include   <iostream>
    using namespace std; 
    #include   "stdafx.h "
    加了命名空间才可以使用string类!读字符串可以直接用 fgets(temp,10,fp);可以直接定义一个string对象把内容全部读出来,用C++的输入输出流更好
      

  7.   

    问题1:在程序中不能定义string类型的参数,是怎么回事? 
    问题2:怎以将1.txt中的内容放到int   temp[10]中,   1.txt中存的都是数字类型#include<string>
    using namespace std;
    (char)temp[i];