Leer txt y buscar por palabras
Publicado por Pablo (1 intervención) el 01/04/2014 21:47:52
Holaaaaaaaa a todos, stoy programando en C# con asp en mvc y tengo st codigo pero me sale un error ya q no encuentra la ubicacion y por ello no se si funcionara o no, si hubiese otro metodo les agradeceria.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
int counter = 0;
string line;
System.IO.StreamReader file = new System.IO.StreamReader(@"c:\temp\test.txt");
while ((line = file.ReadLine()) != null)
{
counter++;
System.Console.WriteLine("There were {0} lines.", counter);
System.Console.ReadLine();
char[] delimit = new char[] { ' ' };
StreamReader objReader = new StreamReader(@"c:\ejborrame\test.txt", System.Text.Encoding.UTF7);
string linea = "";
ArrayList arrText = new ArrayList();
while (linea != null)
{
linea = objReader.ReadLine();
if (linea != null)
{
foreach (string substr in linea.Split(delimit))
{
if (substr != "")
arrText.Add(substr);
}
}
}
objReader.Close();
Valora esta pregunta
0