将字符串写入具有特定扩展名的文件 [英] Writing a string to a file with specific extension

查看:76
本文介绍了将字符串写入具有特定扩展名的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在使用vb来编码visual studio2012。我想知道一种方法将一些字符串写入文件而不是文本文件,但我想指定我保存字符串的文件的扩展名。拜托,帮帮我吧。我正在使用vb

解决方案

您可以在文件创建调用中指定您喜欢的任何扩展名。没有人会阻止你在文本数据中写入,例如 .bin 文件。


尝试:

 File.WriteAllText(  D:\Temp \ MyFile.XZY  这是一些文字......


Hello, please i am using vb to code in visual studio2012. I want to know of a way to write some string into a file and not a text file but i want to specify the extension of the file i am saving the strings to. Please, help me out. I am using vb

解决方案

You may specifier whatever extension you like, in the file creation call. No one would stop you writing textual data inside a, for instance, .bin file.


Try:

File.WriteAllText("D:\Temp\MyFile.XZY", "This is some text...")


这篇关于将字符串写入具有特定扩展名的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆