char CTest_01Ctrl::Readfile(char* pathname)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// TODO: Add your dispatch handler code herechar a[100];
char a[100];
char str;
//char s[80];
int i=0;
ifstream infile;
infile.open(pathname);
while(!infile.eof())
{
infile.getline(a,100,'\n');
i++;
}
for(int j=0;j<i;j++)
{
str+=a[j];
}
infile.close();
return str;
}
</p> <!-- function RunFunc() { var lNum=x.Add(document.getElementById("name1").value ,document.getElementById("name2").value ); var a=document.getElementById("name1").value; var b=document.getElementById("name2").value; alert(a+"+"+b+"="+lNum); } function RunFunc2() { var text=document.getElementById("name3").value; alert(MyActivex.Readfile(text)); } // --> <p>编译成功了,上一个加法运算可以的,但是下面这个读取文件点击网页没反应,求大神帮看看是不是文件读取写的不对.