Currently I am running a program that receives data from an outside device and displays it to the console. I need to be able to take the information received and save it to a log file of some sort. I then need to be able to parse each line for several different things. My information is seperated by "comma's" which should make the parsing easier. This is an example of my string that I need individual data parsed from.


Re: Parsing Data from console.writeline 80 80

You don't mention what OS you are using, but most of them have a way from the command line to pipe the output of a program to another source, such as a text file. On windows this can be done like

SomeProgram > Output.txt

to write the output of SomeProgram to the file Output.txt. This might be the easiest way to get the output (unless you need to process it as it is running).

Then it is a simple matter of reading the file and using something like Scanner or java.util.regex or String.split to pull out the fields you need.

Re: Parsing Data from console.writeline 80 80

and? What's the problem?
You have the data, so use it.

Re: Parsing Data from console.writeline 80 80

Well please don't abuse anybody here. You seen to be programming your code in C# -> Console.writeline(). So please post it to C# posts. You will get C# related answers there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.