首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

D语言读写资料的操作(原创)

2012-11-19 
D语言读写文件的操作(原创)import std.streamimport std.stdiovoid main () {?File file new File ?F

D语言读写文件的操作(原创)

import std.stream;
import std.stdio;

void main () {
?File file = new File ;
?File OutFile = new File;?
?try {
? file.open("1.srt",FileMode.In);
? OutFile.open("out.srt", FileMode.Out);
? while(!file.eof()) {
? ? char[] str=file.readLine();
? ? OutFile.writeLine(str);
??? //printf("%.*s\n",file.readLine());
? }
?}
?catch (Exception x) {
? writefln("Datei kann nicht geoeffnet werden ");
? throw x;
?}
?OutFile.close();
?file.close();
?}

热点排行