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.

$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A

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.

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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.