net8:文本文件的创建及其读写
原文发布时间为:2008-08-06 —— 来源于本人的百度文章 [由搬家工具导入]
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{//create and write
string info = TextBox1.Text;
string name = TextBox3.Text;
FileStream fs = new FileStream(Server.MapPath("~/txt/" + name + ".txt"), FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
sw.WriteLine(info);
sw.Close();
fs.Close();
Response.Write("<script>alert('Create " + name + ".txt')</script>");
}
protected void Button2_Click(object sender, EventArgs e)
{//read
string name = TextBox4.Text;
TextBox2.Text = File.ReadAllText(Server.MapPath("~/txt/" + name + ".txt"), Encoding.Default);
}
}
net8:文本文件的创建及其读写的更多相关文章
- C# 对文本文件的几种读写方法总结
计算机在最初只支持ASCII编码,但是后来为了支持其他语言中的字符(比如汉字)以及一些特殊字符(比如€),就引入了Unicode字符集.基于Unicode字符集的编码方式有很多,比如UTF-7.UTF ...
- 消息队列的创建与读写ftok,msgget,msgsnd,msgrcv,指令ipcs,ipcrm 查看,删除消息队列
ipcs是Linux下显示进程间通信设施状态的工具.可以显示消息队列.共享内存和信号量的信息.对于程序员非常有用,普通的系统管理员一般用不到此指令. ipcs -q 查看系统使用的IPC队列资源 ip ...
- C#创建、读写、增加、删除XML操作
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...
- 【aardio】]SQL创建、读写 excel
import access; var db,err = access( "/test.xls" ) //文件不存在可自动创建 //创建表 if( ! db.existsTable( ...
- Java之文本文件的创建和读取(含IO流操作)
工具类:对文件的读取,创建.直接复制拿来用! package cn.zyzpp.util; import java.io.BufferedReader; import java.io.Buffered ...
- C#创建cookie读写cookie
一.创建cookie HttpCookie cookie = new HttpCookie("UserInfo");//创建多值cookie cookie ...
- 管道的创建与读写pipe
1.管道的创建 #include <unistd.h> int pipe(int pipefd[2]); linux下创建管道可以通过函数pipe来完成.该函数如果调用成功,数组中将包含两 ...
- WinForm 创建与读写配置文件
(转自:http://www.cnblogs.com/SkySoot/archive/2012/02/08/2342941.html) 1. 创建 app.config 文件: 右击项目名称,选择“添 ...
- Linux学习之路4——文件IO打开、创建、读写操作
1.使用man 2 open.man 2 creat.man 2 write.man 2 read命令获取头文件 语法: int open(const char *pathname, int flag ...
随机推荐
- C#入门(2)
C#入门(2) Exception 基本异常的核心成员: System.Exception Property Meaning Data read-only,实现了IDirectory接口的一些键值对, ...
- Java Web应用中获取用户请求相关信息,如:IP地址、操作系统、浏览器等信息
引入jar包 <dependency> <groupId>eu.bitwalker</groupId> <artifactId>UserAgentUti ...
- keras中的shape/input_shape
在keras中,数据是以张量的形式表示的,张量的形状称之为shape,表示从最外层向量逐步到达最底层向量的降维解包过程.“维”的也叫“阶”,形状指的是维度数和每维的大小.比如,一个一阶的张量[1,2, ...
- iptables 过滤字符串
iptables 过滤字符串 1. 开启iptables iptables -P OUTPUT ACCEPT ###允许输出链 service iptables save ...
- virtualenvwrapper.sh报错: There was a problem running the initialization hooks.解决
由于在ubuntu环境下,将python做与python3.6做了软链接(ln -s python python3.6),并且pip也被我做了软链接,所以导致用pip安装virtualenvwrapp ...
- 八:SQL之DQL数据查询语言单表操作
前言: DQL数据库查询语言是我们在开发中最常使用的SQL,这一章总结了单表操作部分的常用查询方式 主要操作有:查询所有字段.查询指定字段.查询指定记录.带IN的关键字查询,范围查询,陪查询.查询空值 ...
- 纯 CSS 创作一个表达怀念童年心情的条纹彩虹心特效
效果预览 在线演示 按下右侧的"点击预览"按钮可以在当前页面预览,点击链接可以全屏预览. https://codepen.io/comehope/pen/QxbmxJ 可交互视频教 ...
- linux文本界面../和./的区别
linux文本界面../和./的区别 ../代表的是上一个目录 ./代表的当前目录
- Lambert (兰伯特)光照模型
Lambert (兰伯特)光照模型 是光源照射到物体表面后,向四面八方反射,产生的漫反射效果.这是一种理想的漫反射光照模型.如下图:这个是顶点函数处理后的该光照模型,因此看起来像素不够平滑. 漫反射 ...
- swift写一个简单的列表unable to dequeue a cell with identifier reuseIdentifier - must register a nib or a cla
报错:unable to dequeue a cell with identifier reuseIdentifier - must register a nib or a class for the ...