VC中怎么将一个文件中的一段文字写入另一个文件。
2011-11-10
展开全部
int retCode=-1;
char buff[1024*10];
typedef int (WINAPI ICEPUB_GETSUBSTRINGFROMFILE)(char *strFilename,char *strResult,char *strBegin,char *strEnd);
ICEPUB_GETSUBSTRINGFROMFILE *icePub_getSubStringFromfile = 0;
typedef int (WINAPI ICEPUB_WRITETEXTTOFILE)(char *strText,char *strFilename,int traceFlag);
ICEPUB_WRITETEXTTOFILE *icePub_writeTextToFile = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_getSubStringFromfile = (ICEPUB_GETSUBSTRINGFROMFILE *)GetProcAddress(hDLLDrv, "icePub_getSubStringFromfile");
icePub_writeTextToFile = (ICEPUB_WRITETEXTTOFILE *)GetProcAddress(hDLLDrv, "icePub_writeTextToFile");
}
if(icePub_getSubStringFromfile)
{
retCode = icePub_getSubStringFromfile("D:\\a.htm",buff,"<body>","</body>");
}
//AfxMessageBox(buff);
if(icePub_writeTextToFile != NULL)
{
icePub_writeTextToFile(buff,"D:\\b.txt",1);
}
if(hDLLDrv)
FreeLibrary(hDLLDrv);
char buff[1024*10];
typedef int (WINAPI ICEPUB_GETSUBSTRINGFROMFILE)(char *strFilename,char *strResult,char *strBegin,char *strEnd);
ICEPUB_GETSUBSTRINGFROMFILE *icePub_getSubStringFromfile = 0;
typedef int (WINAPI ICEPUB_WRITETEXTTOFILE)(char *strText,char *strFilename,int traceFlag);
ICEPUB_WRITETEXTTOFILE *icePub_writeTextToFile = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_getSubStringFromfile = (ICEPUB_GETSUBSTRINGFROMFILE *)GetProcAddress(hDLLDrv, "icePub_getSubStringFromfile");
icePub_writeTextToFile = (ICEPUB_WRITETEXTTOFILE *)GetProcAddress(hDLLDrv, "icePub_writeTextToFile");
}
if(icePub_getSubStringFromfile)
{
retCode = icePub_getSubStringFromfile("D:\\a.htm",buff,"<body>","</body>");
}
//AfxMessageBox(buff);
if(icePub_writeTextToFile != NULL)
{
icePub_writeTextToFile(buff,"D:\\b.txt",1);
}
if(hDLLDrv)
FreeLibrary(hDLLDrv);
参考资料: icePubDll百度之
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询