How to format the screen output?

C

cdrsir

I want to output my results on the screen like this:

The actual counter is: xxx

where xxx is a variable, integer for example, it is desired to be
changed. But how to keep the strings "The actual counter is:" on the
screen using C/C++.

A good example is on the logging page of gmail, there the storage
counter is increasing ...
 
M

mlimber

cdrsir said:
I want to output my results on the screen like this:

The actual counter is: xxx

where xxx is a variable, integer for example, it is desired to be
changed. But how to keep the strings "The actual counter is:" on the
screen using C/C++.

A good example is on the logging page of gmail, there the storage
counter is increasing ...

There is no platform-independent way to accomplish this. Consult your
platform libraries for help. <OT>On Unix look up curses, and on Windows
look up conio.h.</OT>

Cheers! --M
 
D

Default User

cdrsir said:
well, I already know how to do it, just use \b

It's not guaranteed to do anything of the sort, although it usually
will. The more typical way is to use something like:

std::cout << "\rItem: " << [some value] ;

This works on most terminals, but you have to want to stay on the same
line for the whole period.

Also, read the information below.



Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top