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
查看全文
相关阅读:
Java--从键盘读取
java--mkdirs()
Java--正则表达式
java--利用Filereader BufferedReader读取文本文档
java--lambda表达式和动态数组arraylist的forEach方法
substring 方法
ES 字符串操作
slice方法
process.env.NODE_ENV
像素
原文地址:https://www.cnblogs.com/pcsky/p/33884.html
最新文章
ES
Redis
Redis
ES
Redis
Redis
Redis
Redis
Redis
grep: /usr/include/php/main/php.h: No such file or directory
热门文章
centos安装php7
CentOS6给网站开通免费https
【转】cygwin安装MySQL并作为windows服务启动
在博客中加入视频播放的功能
tomcat部署jsp项目
Java——IO——file类
Java——字符串的split方法
Java---读取大文件并计时
Java——复制文件夹和文件
Java---获取当前时间
Copyright © 2011-2022 走看看