Hi all,
I just gone through one requirement.
I want to take the value from the user.
I have one txt file in the same project where i take value from the user.
The value should save into the last line of the txt file.
How to do it?
Thanks
Darma
Loading
VulpesPosted Oct 24, 2012, 7:15 AM
If, say, the user is entering the new line in a textbox and then pressing a button to append it to a file on the server, then the code would be similar to this:
darma tejaPosted Oct 24, 2012, 6:48 AM
Thanks for reply.
I want to do it in webform not on console.
I want to add a new value in new line into the text file.
Darma
VulpesPosted Oct 24, 2012, 6:32 AM
using System;
using System.IO;
class Test
{
static void Main()
{
StreamWriter sw = new StreamWriter("darma.txt", true); // 'true' appends to file
Console.Write("Enter line to append : ");
string line = Console.ReadLine();
sw.Write("\r\n" + line);
sw.Close();
}
}