• Post Reply Bookmark Topic Watch Topic
  • New Topic

File I/O questions  RSS feed

 
Lucas Mac
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 ]
 
Chris Allen
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
 
Dirk Schreckmann
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...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!