|
-
May 6th, 2001, 10:34 AM
#1
C#
In c# , How can we open a file in write mode and write into it.
-
June 9th, 2001, 12:11 AM
#2
Re: C#
Hi,
You can use FileStream class to create or open file and use StreamWriter class to write into file.
Here is an example :
using System.IO;
class TestWriteFile
{
public static void Main()
{
FileStream fs = new FileStream("text.txt", FileMode.Create);
StreamWriter w = new StreamWriter(fs);
w.WriteLine("This is a test string");
w.Flush();
w.Close();
fs.Close();
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|