//注意编码
using System;
using System.IO;
using System.Text;
namespace ConsoleApplication1
{
class Class1
{
static void Main(string[] args)
{
string s="hello,你好!";
FileStream fs=new FileStream("hi.txt",FileMode.Create,FileAccess.Write);
byte[] bArr=Encoding.Default.GetBytes(s);
fs.Write(bArr,0,bArr.Length);
fs.Close();
}
}
}
using System;
using System.IO;
using System.Text;
namespace ConsoleApplication1
{
class Class1
{
static void Main(string[] args)
{
string s="hello,你好!";
FileStream fs=new FileStream("hi.txt",FileMode.Create,FileAccess.Write);
byte[] bArr=Encoding.Default.GetBytes(s);
fs.Write(bArr,0,bArr.Length);
fs.Close();
}
}
}
解决方案 »
- 在WinForm中如何设置datagridview某单元格的Enabled=false
- 如何在代码中设置文件的打开方式?
- 远程连接sql server2000数据库的问题
- 哪位能详细介绍以下Microsoft Visual Studio 2005开发ActiveX控件的详细步骤
- 将一个字符串重排顺序的小问题,妹妹急求!
- 如何生成wmf格式的文件?
- ADO.net问题!!急!
- 新手问问题拉。。。。求高手帮助
- MSDN还有某些书中讲到SQL语句及存储过程,这个存储过程指的是什么?
- MSMQ可以访问其他计算机的私有队列吗?
- 如何建立复杂统计报表?
- 从网上下了个TeeChart,装在机子上,那位高手教一下怎么用啊···
byte[] bytes = uni.GetBytes(str);
fileStream.Write(bytes, 0 , bytes.Length);fileStream.Close();
filestream fs=new filestream("file.txt",filemode.creat,fileaccess.write);
byte[] by=encoding.default.getbytes(str);
fs.write(by,0,by.length);
fs.close();
sw.WriteLine(string);
string 可用中文,写文件不分中英文
sw.Close();
sw.WriteLine(string);
string 可用中文,写文件不分中英文
sw.Close();