批量生成文件并写入大量内容

原创 2013年12月05日 10:07:08
// CreatFile.cpp : Defines the entry point for the console application.
//


#include "stdafx.h"
#include <iostream>
#include<fstream>
#include <string>
using namespace std;

void createFile(string name,string content){

	string path="d:\\"+name+".txt";
	ofstream f1(path);
    if(!f1)return;
	f1<<content<<endl; 
    f1.close();
}

int _tmain(int argc, _TCHAR* argv[])
{
	string  titles[]={"Hinit","HRest1","HRest2","HRest3","HRest4"};
	string content[5];
	string words[]={"yi","er","san","si","wu","liu","qi","ba","jiu","shi","zou","ting","zuo","zhan","ting1","kan","qianjin",
		"houtui","zuozhuan","youzhuan","houzhuan","qili","xiadun","huishou","tiaowu","changge","dingwei","shibie",
		"daiji","shuohua","taitou","xingzou","tingzhi","zhuantou","dazhaohu","dataiji","wangqianzou","xianghoutui",
		"xiangzuozhuan","xiangyouzhuan","zhaoshengyin","jirenlian","yiyanbufa","chayanguanse","shanqiyingren","wenjiqiwu",
		"ertingbafang","taotaobujue","shouzhudaitu","zuoguyoupan"};
	
	  for(int j=0;j<50;j++){
	  content[0]+="Hinit -A -D -T 1 -S training/trainlist_"+words[j]+".txt -M model/hmm0 -H model/proto/hmm_"+words[j]+" -l "+words[j]+" -I training/lab_"+words[j]+".mlf "+words[j]+"\n";
	  content[1]+="HRest -A -D -T 1 -S training/trainlist_"+words[j]+".txt -M model/hmm1 -H model/hmm0/hmm_"+words[j]+" -l "+words[j]+" -I training/lab_"+words[j]+".mlf "+words[j]+"\n";
	  content[2]+="HRest -A -D -T 1 -S training/trainlist_"+words[j]+".txt -M model/hmm2 -H model/hmm1/hmm_"+words[j]+" -l "+words[j]+" -I training/lab_"+words[j]+".mlf "+words[j]+"\n";
	  content[3]+="HRest -A -D -T 1 -S training/trainlist_"+words[j]+".txt -M model/hmm3 -H model/hmm2/hmm_"+words[j]+" -l "+words[j]+" -I training/lab_"+words[j]+".mlf "+words[j]+"\n";
	  content[4]+="HRest -A -D -T 1 -S training/trainlist_"+words[j]+".txt -M model/hmm4 -H model/hmm3/hmm_"+words[j]+" -l "+words[j]+" -I training/lab_"+words[j]+".mlf "+words[j]+"\n";
	  	}
	

	for(int j=0;j<5;j++){
		createFile(titles[j],content[j]);
		}
	return 0;
}


版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

Java批量生成文件并写入内容

最近写一些网页,这些网页里面有部分内容是相同的,网页文件名要求也是有规律的。一看这些需求就觉得可以用程序实现。一般做法是重复复制粘贴的动作,但是文件多起来就有点烦了。所以要用程序解放生产力。程序代码p...

大量包含Insert语句的脚本文件批量执行导入数据

http://hi.baidu.com/ljm0211/item/acf758d40a4839866dce3fb3         今天,同事让我帮忙处理这样一个问题:PM提供了数十个.dat文件,...

Android sqlite批量插入/删除/更新大量文件

转载:http://www.iteye.com/topic/1133521 对比在android中批量插入数据的3中方式对比(各插入1W条数据所花费的时间): 1、 一个一个插入  ...

大量excel文件批量转换成印刷pdf文件:两个小表格自动合成一页

一个数据区仅有5行5列的表格不仅浪费资源,也不好看。用excel排版大师可以自动把2到3个小表格合并为1页。小表格列数可以不同。
  • bq_cui
  • bq_cui
  • 2015-11-07 17:01
  • 1203

手把手教你-----巧用Excel批量生成SQL语句,处理大量数据

在做系统或者做项目的时候,经常会遇到这样的要求:用户给我们发过来一些数据,要求我们把这些数据导入到数 据库中,对于少量的数据来说,用最原始的方法就可以解决,直接在SQL里面用语句来实现,但是如果有成千...

通过Excel生成批量SQL语句,处理大量数据的好办法

我们经常会遇到这样的要求:用户给发过来一些数据,要我们直接给存放到数据库里面,有的是Insert,有的是Update等等,少量的数据我们可以采取最原始的办法,也就是在SQL里面用Insert into...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)