Skip to content

Instantly share code, notes, and snippets.

@MartinAngeloni
Created August 31, 2017 16:50
Show Gist options
  • Save MartinAngeloni/a7e8133637899f3e084b770a9f7e8398 to your computer and use it in GitHub Desktop.
Save MartinAngeloni/a7e8133637899f3e084b770a9f7e8398 to your computer and use it in GitHub Desktop.
Esta es una aplicación de consola que escribe en un archivo .txt creado en un determinado lugar y luego lo lee.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace ConsoleApp4ArchivosRepaso
{
class Program
{
static void Main(string[] args)
{
//para escribir archivos
StreamWriter stw = new StreamWriter(@"C:\Users\martin\Desktop\repaso.txt");
using (stw)
{
stw.WriteLine("LALALAND");
}
stw.Close();
//para leer el archivo
StreamReader str = new StreamReader(@"C:\Users\martin\Desktop\repaso.txt");
using (str)
{
String line = str.ReadLine();
Console.WriteLine(line);
}
str.Close();
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment