This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Weekend Crash Course on a mac; ascii problems?

 
Robert Link
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic