View Single Post
Old 10-27-2004, 01:50 PM   #2 (permalink)
ender
Code Monkey
 
ender's Avatar
 
Join Date: Mar 2003
Location: Evansville, IN
Posts: 75
ender is on a distinguished road
Send a message via AIM to ender Send a message via Yahoo to ender
Thumbs up Carriage Return

This might be a little late, and you might have figured it out already. What you are looking for is the Carriage Return character. This can be accomplished by printing the "\r" special character. This resets the cursor to the beginning of the same line you are currently on. I recently wrote a colored progress bar for the terminal in perl this way.

This makes windows version of newlines a lot easier to understand. Windows requires the full \n\r to get to the next line. I assume it is because they don't automatically reset the cursor to the beginning of the line when the cursor moves down. Therefore, you need the \r in there. Linux does this automatically, and so we get fun battles where lines don't look right in windows when they looked fine in linux.

Although you probably knew that already, so I'm gonna stop now. However, before I sign off, I will mention that if you are looking for cool stuff to do to a 'standard' vt200 terminal (which most linux terminals emulate anyway) the following link will help: Terminal Escape Sequences

Hope this helps. Good luck!

- Ted
ender is offline   Reply With Quote