C sharp - C# CM puedo modificar una linea existente en un txt....!!

 
Vista:

C# CM puedo modificar una linea existente en un txt....!!

Publicado por andrea (2 intervenciones) el 28/11/2011 04:45:04
si alguien me puede ayudar a modificar una linea existente sin borrar las demas, k me ayude xfavor chicos :)
Tengo k hacer un programa x el cual.. leo un txt con informacion de 105 productos ESO YA LO HICE.. y tengo que modificar la linea desea x el usuario eso noc cm hacerlo...
ejemplo en el txt:
papa; 1300 ; 15; 24


mi codigo en consola....

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace afeafae
{
class Program
{
static void Main(string[] args)
{
int[] carro = new int[105];
int[] cantidades = new int[105];
int cuantos;
string SALIR;
int contador = 1;
Boolean salga = false;
salga = false;
do {
string[] articulos = new string[93];
int[] precios = new int[93];
int[] cantidad = new int[93];
int[] impuestos = new int[93];

Console.WriteLine("ARTICULOS");
StreamReader texto = new StreamReader(@"C:\CURSOS\Productoss.txt");
char[] carac = { '\r', '\n' };
string[] escrito = texto.ReadToEnd().Split(carac, StringSplitOptions.RemoveEmptyEntries);
string[] articulosss = new string[escrito.Length];
int[] preciosss = new int[escrito.Length];
int[] cantidadessss = new int[escrito.Length];

for (int i = 0; i < escrito.Length; i++)
{
string[] espacio22 = escrito[i].Split(';');
articulos[i] = espacio22[0];
precios[i] = Int32.Parse(espacio22[1]);
impuestos[i] = Int32.Parse(espacio22[2]);
cantidad[i] = Int32.Parse(espacio22[3]);
}


for (int i = 0; i < articulos.Length; i++)
{
Console.WriteLine("{0}:{1}: {2}: {3}% Stock:{4} ", i + 1, articulos[i], precios[i], impuestos[i], cantidad[i]);
}

texto.Close();
Console.WriteLine("");
Console.WriteLine("CUAL LINEA DESEA MODIFICA");
Console.ReadLine();

Console.WriteLine("DEsea seguir modificando??..");
Console.WriteLine("s/n");
SALIR = Console.ReadLine();
Console.Clear();
}
while (SALIR != "N" && SALIR != "N");
}
}
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder