Tema: Crear un Log
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/01/2013, 21:16
3ricks0ul
 
Fecha de Ingreso: junio-2012
Mensajes: 90
Antigüedad: 11 años, 10 meses
Puntos: 2
Crear un Log

Buenas, tengo el siguiente codigo:

Código C:
Ver original
  1. protected void OnBotonClicked (object sender, System.EventArgs e)
  2.         {
  3.         ProcessStartInfo psi = new ProcessStartInfo ();
  4.         psi.FileName = "/tmp/bash.sh";  /* Nombre del script*/
  5.         psi.UseShellExecute = false;
  6.         psi.RedirectStandardOutput = true;
  7.        
  8.        
  9.         psi.Arguments = "test";
  10.         Process p = Process.Start (psi);
  11.         string strOutput = p.StandardOutput.ReadToEnd (); /*Lee todo el log*/      
  12.        
  13.         p.WaitForExit ();
  14.        
  15.         string path ="/tmp/anatemp.txt";
  16.         using (StreamWriter sw = File.CreateText(path)) /*Se crea en runtime*/
  17.         {
  18.        
  19.         }
  20.         string FileName="/tmp/anatemp.txt";
  21.        
  22.        
  23.          using (StreamWriter w = File.AppendText(FileName))
  24.         {
  25.             w.Write(strOutput);
  26.         }


Quiero tomar la variable "STROUTPUT" e insertarla en "/tmp/anatemp.txt"; a manera de log, pero solo consigo insertarlo una sola vez y se sobre escribe, me gustaria que todas las veces que inserte esa variable sea hacia abajo, perdon por las expresiones pero esque apenas comienzo a moverle al C#, de antemano muchas gracias y espero su ayuda!