Sorry if this is out of line for java-3d but could someone provide me with a
code snippet or info on how to reading scientific notation numbers ( e.g.
5.03E-9 ) from a file?? The file I'm reading contains floats and scientific
notation numbers. I'm using StreamTokenizer is this my problem?? I get a
message that "StreamTokenizer" is deprecated but I'm not sure what to use
instead.
My code flows as follows::
~~~~~~~~~~~~~~
protected StreamTokenizer st;
protected float getNextFloat(){
try {
st.parseNumbers();
st.nextToken();
System.out.println("in getNextFloat: "+st.toString());
if(st.ttype == st.TT_NUMBER){
return((float) st.nval);
} else {
System.out.println("ParseRdr error, expected a float");
return(-1f);
}
} catch (Exception e) {
System.out.println("ParseRdr " + e);
}
return(-2f);
}
~~~~~~~~~~~~~~
the file I'm reading from flows like this::
~~~~~~~~~~~~~~~
3.000000
30000.00
1.6200000E-02
0.7000000
175.0000
~~~~~~~~~~~~~~~
when "st" gets to the "E" in "1.6200000E-02" it is treated like the
nextToken
I'll need to write them back out to a file also but that can probably be
easily figured out by the student given an example on reading them.
Thanx
Kenneth Kearney
516.346.6014, [EMAIL PROTECTED]
Northrop Grumman Corporation
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/