This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

File I/O questions

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following is some code where i simply try to take keyboard input fromt he console and append it to the end of a file (these are the first steps to a chat program i need to make). However, the problem I'm having at the moment is that when I hit backspace at the console the characters do not actually get deleted in the output and the backspace character is also included as one of the characters...what is the best way to eliminate this problem?



/* the following is an example of a session of above code...how can i get it to not keep track of backspaces?
===================================
hey man
yO^Hoooooooooooo, ^H^H!!! what's up?
nuttin much you?
nuttin..goodbye
==================================
*/

[ June 15, 2004: Message edited by: Lucas ]

[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ June 16, 2004: Message edited by: Dirk Schreckmann ]
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lucas,
I did not receive the same problem that you did (but I am on a Windows XP pc). I would expect to see this on UNIX-based systems where the control characters are clearly printed in the files. Perhaps you can guard against the printing of this character in your for loop as such:


Again, I wasn't able to discern any difference in my files but give it a try anyways and let me know. The '\u0008' is the unicode value for the backspace character commonly printed on some terminal emulators as ^H
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lucas,

Welcome to JavaRanch!

We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.

Thanks Pardner! Hope to see you 'round the Ranch!
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Windows XP Professional, and the contents of the text file definitely contained some funny characters where I'd expect a new line to be.

I'm moving this to the I/O and Streams forum, where folks might have some further ideas on nudging you in the right direction...
 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!