permaculture playing cards*
The moose likes Beginning Java and the fly likes Weekend Crash Course on a mac; ascii problems? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Weekend Crash Course on a mac; ascii problems?" Watch "Weekend Crash Course on a mac; ascii problems?" New topic
Author

Weekend Crash Course on a mac; ascii problems?

Robert Link
Greenhorn

Joined: May 21, 2001
Posts: 2
Howdy. I'm working through "Java 2 Weekend Crash Course" from idg. It's aimed at wintel, I'm on mac. Most things have worked fine, but one sample prog has me baffled. It's supposed to start with ascii 0x10 and use a while loop to get up to ascii 0x20, printing the appropriate character to the screen on each iteration of the loop; instead it just prints a new line for each iteration. When I amend the code to concat a string onto the expected ascii I get my string preceded by the little box that seems to mean "control character" on mac. I was hoping someone here might be able to give me a clue; all help appreciated.
Thanks!
Albert Kam
Greenhorn

Joined: May 14, 2001
Posts: 6
um, i never experienced with mac, but i think your problem is around the line-separator.
in windows, the line separator is "\r\n", unix is "\n" and in mac, it's "\r".
try printing those line separators and check whether the weird box shows up.
this is not a solution, but i hope this can do a little help
cyao !
Robert Link
Greenhorn

Joined: May 21, 2001
Posts: 2
My bad; turns out the script works just fine, I just don't know my ascii well enough. 0x10 --> 0x20, according to my little ascii character-set table, are all blanks!! What a stupid example! I re-did the code, using 0x50 --> 0x70, it worked like a charm, priting P --> o. Looks like what I need is an ascii refresher...
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
wood burning stoves
 
subject: Weekend Crash Course on a mac; ascii problems?
 
Similar Threads
Base 128 conversion
Hashing Problem
Looking for JSP tutorial.
cutting string into peaces
Validating a Number