Hi,
I'm trying to read a file and then write in that one. But When I try to write in the file nothing happen.
Here's my code :
using System;
using System.Data;
using System.Drawing;
using System.IO;
using System.Web;
using System.Web.UI ;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public abstract class example
{
private void button_click(object sender, System.EventArgs e)
{
FileStream myReadFile = new FileStream(@"c:\inetpub\ , FileMode.OpenOrCreate , FileAccess.ReadWrite);
StreamReader myStreamReader = new StreamReader(myReadFile) ;
string numeroEnvoi = myStreamReader.ReadLine() ;
int increment = int.Parse(numeroEnvoi) + 1 ;
string addIncrement = increment.ToString() ;
StreamWriter writeReadFile = new StreamWriter(myReadFile) ;
writeReadFile.Write(addIncrement) ;
}
}
Could somebody help me ??? Thanks.
I'm trying to read a file and then write in that one. But When I try to write in the file nothing happen.
Here's my code :
using System;
using System.Data;
using System.Drawing;
using System.IO;
using System.Web;
using System.Web.UI ;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public abstract class example
{
private void button_click(object sender, System.EventArgs e)
{
FileStream myReadFile = new FileStream(@"c:\inetpub\ , FileMode.OpenOrCreate , FileAccess.ReadWrite);
StreamReader myStreamReader = new StreamReader(myReadFile) ;
string numeroEnvoi = myStreamReader.ReadLine() ;
int increment = int.Parse(numeroEnvoi) + 1 ;
string addIncrement = increment.ToString() ;
StreamWriter writeReadFile = new StreamWriter(myReadFile) ;
writeReadFile.Write(addIncrement) ;
}
}
Could somebody help me ??? Thanks.