1、首先输入代码:
FileStream mystream = new FileStream("汪伏C:\\设备配置\\a.txt", FileMode.OpenOrCreate)
StreamWriter Mywriter = new StreamWriter(mystream, Encoding.Default)
string text = ""
2、然后输入代拦唤码:
for (int i = 0 i < axMSFlexGrid1.Rows i++)
for (int j = 0 j < axMSFlexGrid1.Cols j++)
text += flex.get_TextMatrix(i, j) + "\t"
3、然后再输入下困衡携方的代码就完成了。
Mywriter.Write(text)
Mywriter.Close()
mystream.Close()
第一步,返回至电脑的桌面,准备新建TXT文件。/iknow-pic.cdn.bcebos.com/9825bc315c6034a83241af36c5134954082376e1"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/9825bc315c6034a83241af36c5134954082376e1?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/9825bc315c6034a83241af36c5134954082376e1"/>
第二步,在电没喊脑桌面点击鼠标右键,d出右键菜单。
/iknow-pic.cdn.bcebos.com/b7003af33a87e95018b7e5db1e385343faf2b4e0"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/b7003af33a87e95018b7e5db1e385343faf2b4e0?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/b7003af33a87e95018b7e5db1e385343faf2b4e0"/>
第三步,在d出的右键菜单中,选择新建选项。
/iknow-pic.cdn.bcebos.com/e824b899a9014c0883dd3e12047b02087af4f4a7"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/e824b899a9014c0883dd3e12047b02087af4f4a7?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/e824b899a9014c0883dd3e12047b02087af4f4a7"/>
第四步,在新建选项下的子菜单耐戚中选择文本文档,并左键点击。
/iknow-pic.cdn.bcebos.com/3b292df5e0fe9925db0178e73aa85edf8db17173"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/3b292df5e0fe9925db0178e73aa85edf8db17173?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/3b292df5e0fe9925db0178e73aa85edf8db17173"/>
第五步,点击文本文档后,电脑桌面会出现一个未命昌察陵名的TXT格式图标。
/iknow-pic.cdn.bcebos.com/4a36acaf2edda3cc3a3ba9970fe93901203f92ad"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/4a36acaf2edda3cc3a3ba9970fe93901203f92ad?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/4a36acaf2edda3cc3a3ba9970fe93901203f92ad"/>
第六步,双击打开该TXT文档图标,即可输入文字。
/iknow-pic.cdn.bcebos.com/54fbb2fb43166d224a300523482309f79152d2c5"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/54fbb2fb43166d224a300523482309f79152d2c5?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/54fbb2fb43166d224a300523482309f79152d2c5"/>
//看例子和注释#include<stdio.h>
#include<stdlib.h>
int main()
{
//要创建的txt文件的文件名
char f[]="t.txt"
FILE *outf
//以写入的方式打开文件t.txt,如宽前搭果没有,就创建
outf=fopen(f,"w")
//写一句话到文件t.txt
fputs("用C创建了一个文本文件!",outf)
/悔搏/关闭慎拿文件
fclose(outf)
system("PAUSE")
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)