How do i read from a device instead of a file?

Hello,

I am trying to read a line of gps data with java. Here is my situation: After I run a c program, it creates /dev/gps and then, when i type "cat /dev/gps", I can see many lines of longitude/latitudes. I have the following code, but it does not work. I first run my c program and then when i run the java class right after, but it just freezes and doesn't output anything? Any help would be great. Thanks!

RandomAccessFile in = null;

in = new RandomAccessFile("cat dev/gps", "r");

String line = in.readLine();//reads the first line of /dev/gps

System.out.println(line);

//NOTE: I also tried ("dev/gps", "r") instead and I get the same results.

thanks

[714 byte] By [james007g] at [2007-9-27 2:20:04]
# 1
try ("/dev/gps", "r")
cxgd at 2007-7-4 21:38:51 > top of Java-index,Archived Forums,Java Programming...
# 2
HiI tried that and it does read from it. However, It prints the first character of every line instead of printing the line itself. Any suggestions? thanks!
james007g at 2007-7-4 21:38:51 > top of Java-index,Archived Forums,Java Programming...
# 3
can you repost the code that reads and prints
cxgd at 2007-7-4 21:38:51 > top of Java-index,Archived Forums,Java Programming...
# 4

Hi, the code that is supposed to print one line is

String line;

line = in.readLine();

System.out.println(line);

For some reason it just prints LLLLLLLLLLLLLLLL...etc. I'm pretty sure that it is the first character of each line since each line starts with the word "Latitude". Please let me know what i'm doing wrong, thanks!

james

james007g at 2007-7-4 21:38:51 > top of Java-index,Archived Forums,Java Programming...
# 5
It looks like it should work - sorry I cant help.
cxgd at 2007-7-4 21:38:51 > top of Java-index,Archived Forums,Java Programming...