Read specific columns from a text file
Hello,
I wanna read some specific columns from a text file, which is tab separated in fact:
Level [l]
Time setpoint actual value Output [%] V102 Alarm
12:28:42 1,800 0,002 100 0 1
12:28:45 1,800 0,150 100 0 1
12:28:48 1,800 0,321 100 0 1
...
...
Later on Ill use those columns to draw a graph. Anyway, my program is in server side and in the Reply function i need to read the lines, here is my code so far (I though that firstly i should read the lines into an array):
class Reply
{
public string clientMessage;
public List<Array> list;
public Reply(String msg)
{
List<Array> list = new List<Array>();
using (StreamReader sr = new StreamReader(@"C:\blabla\worst.txt"))
{
while (!sr.EndOfStream){
String line = sr.ReadLine();
if (!string.IsNullOrEmpty(line)){
Array lineArray = line.Split(' ');
list.Add(lineArray);
}
}
foreach (Array line in list){ //read the columns here?
}
clientMessage = msg.ToString();
}
}
}
and where i use this function is here:
void onMessageReceived(SuperWebSocket.WebSocketSession session, string msg)
{
Reply reply = new Reply(msg);
string json = server.JsonSerialize(reply);
session.Send(json);
Console.WriteLine("Message received: " + msg);
}
I am getting some errors that i dont understand, can you tell me what should i fix? or if you have better idea please tell me,
Regards,