我正在使用 C#StreamWritier
类。问题:
- 我怎样才能使一个文件只读,这样没有人可以删除或写入它?
- 如何制作隐藏文件?
我正在像这样创建文件:
private void button1_Click(object sender, EventArgs e)
{
SaveFileDialog save = new SaveFileDialog();
save.FileName = textBox1.Text;
save.Filter = "Text File | *.rtf";
if (save.ShowDialog() == DialogResult.OK)
{
StreamWriter writer = new StreamWriter(save.OpenFile());
writer.WriteLine(textBox2.Text);
}
writer.Dispose();
writer.Close();
}