Solved

ostream & position

Posted on 2002-03-17
3
201 Views
Last Modified: 2010-04-01
Hi Expert,

Having this piece of code:

while (...)
{
     cout << setw(16) << x;
}

Need the "x" to be printed at the same position at the window for all the iterations.

Can not find any flag/manipulator for that,
Can you help with this ?

TIA,
Oren.
0
Comment
Question by:orenm
3 Comments
 
LVL 2

Accepted Solution

by:
LoungeLizard earned 100 total points
ID: 6874875
I suppose you mean console, and not window?

Well, there would be specific methods for specific platforms, but on DOS/Windows you could try using the "backspace" character and output that to delete the previous value before writing the new one, something like (crude, could be improved, I s'pose):

char * del = new char[17];
memset(del,0x08,16);
del[16]=0;

Then:

while (...)
{
    cout << del;
    cout << setw(16) << x;
}


0
 

Author Comment

by:orenm
ID: 6878345
Thanx
0
 
LVL 11

Expert Comment

by:griessh
ID: 6955411
Dear orenm

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "LoungeLizard"

comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to understand recursion 12 226
Would like to move button in a function 3 77
FMX enumerated colours 2 100
Which Linux flavors will this run on? 6 88
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question