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
查看全文
相关阅读:
日记10硬件与操作系统安装专用
程序设计与算法(三)C++面向对象程序设计 (北大MOOC)
macbook pro14 前端基本配置【20211114】
springboot配置rabbitmq的序列化反序列化格式
sql优化把派生表改成子查询,查询速度将变快
Android开发 因为ViewPager与SwipeRefreshLayout冲突导致RecyclerView或者其他列表布局的item无法点击的问题
Kotlin开发 委托
Kotlin开发 协程的实践 Retrofit + 协程 + ViewModel
git clean用法
kotlin开发 高阶函数学习与记录
原文地址:https://www.cnblogs.com/pcsky/p/33884.html
最新文章
SSM使用MultipartFile上传文件
1
java api 操作mapredues
简单工厂模式
维度清洗项目实战数据库设计和1层数据流图
报错解决:java.lang.NoClassDefFoundError: org.apache.poi.POIXMLDocument
对老师的评价
CSS 手机端常用信息列表
备忘录模式
策略模式
热门文章
解释器模式
模板模式
迭代器模式
中介模式
建筑者模式
命令模式
状态模式
观察者模式
前端mock方案:使用jsonserver
LeetCode Notes_#42_接雨水
Copyright © 2011-2022 走看看