Eitzenberger Thomas wrote:

> pat cavanagh wrote:
>
> > >             }
> > >           System.in.skip(1);            //remove nl
> > >         }while(prod!='x'&&prod!='X');
> > >       System.out.println("Total Weekly Pay is $"+_total);
> > >    }
> > > }
> > >
> >
> > maybe one of these last lines needs to change a little bit?
> > if you are really close to a deadline i can tell you the answer,
> > but the problem basically is that this command line stuff is
> > not portable across architectures. pay close attention to
> > the different values returned by windows and unix pressing
> > the enter key, and the answer will leap out and byte you.
> > see your instructor and ask for only graphical assignments,
> > then you should be ok. if your deadline fast approaches,
> > i can tell you the answer in return for copious amounts of
> > beer. ;-)
> >
> > hope this helps,
> > kanpai!
> > pat
>
>  I never tried it but isn't there a property called line.separator  in
> java.lang.System.getProperties() ??
>

ah yes, so there is. i've never tried it either, because after all, if i
wantedcommand line stuff, i would probably use perl, or maybe c++ if i was
feeling
really masochistic. but looking at the web page
http://www.javasoft.com/products/jdk/1.1/docs/api/java.lang.System.html#getProperties()

http://www.javasoft.com/products/jdk/1.1/docs/api/java.util.Properties.html#_top_

it looks like you could do something like this:
Properties p = System.getProperties();
String nl = p.getProperty("line.separator");

and then see if the next stuff on System.in is the same as nl.
i guess that would be portable. so to correct my previous
statement, "this command line stuff is easy to write non-portably
and a bit more work to write portably."


> BTW could I get a beer too ?

free beer for everybody! it's the new age of the java linux list.

kanpai!
pat


Reply via email to