没有合适的资源?快使用搜索试试~ 我知道了~
可对相应目录下的文件中的英文单词进行匹配索引,并输出到另一文件中。本代码只是对文件操作提供一点示例。
资源推荐
资源详情
资源评论
#include <iostream.h> // 文件操作必须的头文件
#include <fstream.h>
void compare_(char *sourcestr,char aimch,int fitnum,char *aimbuffer);
void main()
{
fstream file1; // 定义一个fstream类的对象用于读
file1.open("C:\\Program Files\\Microsoft Visual Studio\\COMMON\\MSDev98\\Bin\\font_1.txt", ios::in);
if (!file1)
{ cout<<"font_1不能打开!\n"; return; }
else
cout<<"succed to open font_1\n";
fstream file2; // 定义一个fstream类的对象用于写
file2.open("D:\\test.txt", ios::out );
if (!file2)
{
cout<<"test.txt不能创建!\n";
file1.close(); return;
}
else
cout<<"succed to open test\n";
char ch;
char arry[80];
int i=0,j=0;
while(file1.get(ch)) //或:file1.read(&ch,1)
{
arry[i]=ch;
++i;
}
cout<<i<<"\n";
while(j!=i)
#include <fstream.h>
void compare_(char *sourcestr,char aimch,int fitnum,char *aimbuffer);
void main()
{
fstream file1; // 定义一个fstream类的对象用于读
file1.open("C:\\Program Files\\Microsoft Visual Studio\\COMMON\\MSDev98\\Bin\\font_1.txt", ios::in);
if (!file1)
{ cout<<"font_1不能打开!\n"; return; }
else
cout<<"succed to open font_1\n";
fstream file2; // 定义一个fstream类的对象用于写
file2.open("D:\\test.txt", ios::out );
if (!file2)
{
cout<<"test.txt不能创建!\n";
file1.close(); return;
}
else
cout<<"succed to open test\n";
char ch;
char arry[80];
int i=0,j=0;
while(file1.get(ch)) //或:file1.read(&ch,1)
{
arry[i]=ch;
++i;
}
cout<<i<<"\n";
while(j!=i)
资源评论
edward0414
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功