c/c++中fputs函数的使用???
寒拓冰 2011-05-24 07:47:22 源文件如下:
#include <string>
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int i;
char buf;
string src,str1="http";
FILE *fp,*fp1;
if((fp=fopen("200848140312_刘沛.htm","r"))==NULL)
{
cout<<"文件打开失败,请检查文件是否存在!!!"<<endl;
return 0;
}
if((fp1=fopen("200848140312.txt","w"))==NULL)
{
cout<<"文件写入失败!!!!"<<endl;
return 0;
}
buf=fgetc(fp);
while(buf!=EOF){
if(buf='"'){
src="";
buf=fgetc(fp);
for(i=0;i<4;i++)
{
src=src+buf;
buf=fgetc(fp);
}
if(strcmp(src.c_str(),str1.c_str())==0)
{
while(buf!='"')
{
src=src+buf;
buf=fgetc(fp);
}
fputs(src.c_str ,fp1);
cout<<src<<endl;
buf=fgetc(fp);
}
}
}
fclose(fp);
fclose(fp1);
return 0;
}
在使用fputs时提示出错:rror C2664: 'fputs' : cannot convert parameter 1 from 'const char *(void) const' to 'const char *'
There is no context in which this conversion is possible
这个怎么改啊??????