zoukankan
html css js c++ java
ASP.net 写文件的函数(内容,路径,文件名) pcsky(原作)
'
写文件的函数(内容,路径,文件名)
Public
Sub FileWrite()
Sub
FileWrite(
ByVal
Str
As
String
,
ByVal
myPath
As
String
,
ByVal
myFileName
As
String
)
Dim
path
As
String
=
HttpContext.Current.Server.MapPath(myPath)
'
路径
Dim
temp
As
String
=
path
&
"
"
&
myFileName
'
路径+文件名
'
删除原文件,如果存在
If
File.Exists(temp)
Then
File.Delete(temp)
End
If
'
建立新文件
Dim
fs
As
FileStream
=
File.Create(temp)
Dim
info
As
Byte
()
=
Encoding.GetEncoding(
"
gb2312
"
).GetBytes(
Str
)
'
把内容添加到文件中
fs.
Write
(info,
0
, info.Length)
fs.Close()
'
Response.Write("<br>文件成功写入!")
End Sub
查看全文
相关阅读:
SQL Server 实现Split函数
15.java设计模式之访问者模式
14.java设计模式之命令模式
13.java设计模式之模板模式
12.java设计模式之代理模式
11.java设计模式之享元模式
10.java设计模式之外观模式
9.java设计模式之组合模式
8.java设计模式之装饰者模式
7.java设计模式之桥接模式
原文地址:https://www.cnblogs.com/pcsky/p/33884.html
最新文章
woj1009 最短路 The Legend of Valiant Emigration
woj1008feedinganimals2-贪心-网络流
Ajax基础
前端跨域问题笔记
forEach和some区别
如何理解JavaScript中的面向对象编程呢?
JavaScript中this指向
Es6的箭头函数
Es6的Let和Const
JavaScript作用域和作用域链
热门文章
BootStrap栅格系统
cookies,sessionStorage和localStorage的区别
JS、C#编码解码
Java集合框架学习(一)List
System.ComponentModel.DataAnnotations 冲突
.NET Exceptionless 本地部署踩坑记录
一些JQuery使用技巧
.NET和JAVA 反射对比
JQuery日期选择控件-兼容手机端
【转载】SQL Server行转列,列转行
Copyright © 2011-2022 走看看