473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How to format text input/output?

People, is it possible to control command prompt text output in Java as it
is in C? I mean, cam I print a line, them erase that line and repreint it
in the same line?

Thanks,
Scirious.
Jun 1 '06 #1
2 10909
"Scirious" <sc******@scirious.com> wrote in message
news:f8********************@giganews.com...
People, is it possible to control command prompt text output in Java as it
is in C? I mean, cam I print a line, them erase that line and repreint it
in the same line?


When you do this in C, you're usually using a terminal control library,
such as Curses (
See http://en.wikipedia.org/wiki/Curses_...ing_library%29)

There's no cross-platform way to do this in Java, because some platforms
that Java runs on doesn't support erasing an already printed line (think
mainframes with no screens, but with line-printer outputs).

If you don't care about those platforms, you can use JNI to interface
with Curses (or any other library)from within Java.

- Oliver

Jun 2 '06 #2
On Thu, 01 Jun 2006 14:56:38 -0500, Scirious wrote:
People, is it possible to control command prompt text output in Java
as it is in C? I mean, cam I print a line, them erase that line and
repreint it in the same line?


As long as you stay on the same line (no linefeed), most terminals
support \r to go back to the start of the line.

for (int i=0; i<10; i++) {
System.out.print("this is line " + i + "\r");
}
System.out.println();

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Jun 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim | last post by:
im using asp.net, C# to enter data into a table in sql server...however im getting this error: Input string was not in a correct format. Description: An unhandled exception occurred during the...
4
by: Newbie | last post by:
How would I modify this form to encode *all* the characters in the 'source' textarea to the '%xx' format & place result code into the 'output' textarea? (cross browser compatable) Any help is...
7
by: Sobhan | last post by:
Hi all, Iam writing a small C program to print a array of numbers in Comma Separated Values in VC++ editor. Lets say: Title Title1 Title2 ----- ------ ------ 10,20,30 50,90,100 120,180,300
5
by: google | last post by:
first, a little background... i have a C program which preprocesses some data, and then outputs the results into a text file. that text file, in turn, is used as input to a FORTRAN...
2
by: Pat | last post by:
Here is my problem that I am having with a current project. I went and backed up all my hard drives to DVD's. After backing up the drives, I used a batch file to get all the file names from the...
4
by: Jack | last post by:
Hi, I have the following Access DDL statment from which I generated a access table: CREATE TABLE TEST1 (ID COUNTER, NAME TEXT(50), STORAGESPACEASSIGNED TEXT(50) )
7
by: basyarie | last post by:
Dear VB mania, especially VB6 specialist I have a problem with my GPS. So far, I have a GPS-M1zz from Pioneer Navicom company. It has 2 type of data format, i.e. Pioneer Format and NMEA data...
9
by: seep | last post by:
hi i m finding following error on the code that i wants to use to get all record from table via store procedure with paging. the error is : Input string was not in a correct...
8
by: joemacbusiness | last post by:
Hi All, How do I format printed data in python? I could not find this in the Python Reference Manual: http://docs.python.org/ref/print.html Nor could I find it in Matloff's great tutorial:...
6
by: Lilith | last post by:
I'm trying to build a string for eventual output to a file. Input comes from a number of input boxes but I've only test on one text box content when I get an exception at runtime. The program...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.