🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.api
Article #10

Re: Strange I/O behavior

#10
From: MWRon
Date: Thu, 07 Dec 2000 17:11
39 lines
2421 bytes
In article <mtobin-99A222.22175206122000@news.earthlink.net>, Michael
Tobin <mtobin@macalester.edu> wrote:

>I've been trying to get a java program to run on my Mac.  It is a 
>microprogramming simulator (for use with "Structured Computer 
>Organization" by Andrew Tanenbaum).  The package comes with an assembly 
>language assembler and a microprogram assembler.  The problem is that it 
>runs perfectly well on Windows and Unix systems, but for some reason, it 
>will not work on my Mac.  After much effort and debugging, I have found 
>the culprit (the variable 'in' is of type BufferedInputStream):
 
>/***********************************************************************/
>                     /* This loop right HERE!
>                     while (((char)ch) != '\n' && ch > -1)
>                     {
>                        ch = in.read();
>                     }
>/**********************************************************************/
 
It is because Macs use  a different line ending than UNIX does.  the 0xA
and 0xD are turned around.

Try

 while (((char)ch) != ('\n' || '\r') && ch > -1)

Note I'm a C programer not Java so I'd appreciate any corrections on my
assumptions.


Ron

-- 
CodeWarrior PersonalJava Edtion
The speed, integration, and flexibility of the product are truly impressive.
Java Report Online
http://www.javareport.com/html/from_pages/product_review.cfm?articleID=1616

Metrowerks  "Software Starts Here"   MWRon@metrowerks.com
Technical Details
Message-ID: <mwron-0712001211280001@c243286-a.bcreek1.mi.home.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!cyclone-sf.pbi.net!165.113.238.17!pln-w!spln!dex!extra.newsguy.com!newsp.newsguy.com!mwron
References: <mtobin-99A222.22175206122000@news.earthlink.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bcce,139b3b33219ebf5
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,139b3b33219ebf5
X-Google-Attributes: gidf635e,public
X-Google-Thread: fecd1,139b3b33219ebf5
X-Google-Attributes: gidfecd1,public
X-Google-ArrivalTime: 2000-12-07 09:51:43 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!cyclone-sf.pbi.net!165.113.238.17!pln-w!spln!dex!extra.newsguy.com!newsp.newsguy.com!mwron
From: mwron@metrowerks.com (MWRon)
Newsgroups: comp.lang.java.api,comp.sys.mac.programmer.codewarrior,codewarrior.mac
Subject: Re: Strange I/O behavior
Date: Thu, 07 Dec 2000 12:11:28 -0500
Organization: Metrowerks
Lines: 39
Message-ID: <mwron-0712001211280001@c243286-a.bcreek1.mi.home.com>
References: <mtobin-99A222.22175206122000@news.earthlink.net>
NNTP-Posting-Host: p-487.newsdawg.com
X-Newsreader: MT-NewsWatcher 2.4.4