473,413 Members | 1,700 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,413 software developers and data experts.

output question

J.D
Hi everyone.

I've been trying to create a simple program that would allow the user
to see an updated set of values without having newline after newline.

For example:

Value: 4 // the 4 could be replaced in the same position
with another
number and so on.

I've been playing around with sprintf and I've gotten good results
with:
/* Placed in a loop with a time delay. Values are updated in the same
line
*/
sprintf(buff, "\r Cpu 0 Temp: %.2f C Cpu 1 Temp: %.2f C Sys Temp:
%.2f C ", t, t1, t2);

cout << buff;
However, when i add a second row:

Cpu 0 Temp: 30 C Cpu 1 Temp: 31 C Sys Temp: 30 C
HD Size: 20 G

my solution no longer works.
Any help would be appreciated.

Thanks
Jul 22 '05 #1
3 1358
J.D wrote:
I've been trying to create a simple program that would allow the user
to see an updated set of values without having newline after newline.


You are asking how to reposition your console's cursor. This newsgroup is
not qualified to answer; you'd get better results using
http://groups.google.com , and seeking either "ANSI escape sequences" or
"wincon.h".

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces
Jul 22 '05 #2
yn***********@yahoo.com (J.D) wrote in message news:<a2**************************@posting.google. com>...
Hi everyone.

I've been trying to create a simple program that would allow the user
to see an updated set of values without having newline after newline.

For example:

Value: 4 // the 4 could be replaced in the same position
with another
number and so on.

I've been playing around with sprintf and I've gotten good results
with:
/* Placed in a loop with a time delay. Values are updated in the same
line
*/
sprintf(buff, "\r Cpu 0 Temp: %.2f C Cpu 1 Temp: %.2f C Sys Temp:
%.2f C ", t, t1, t2);

cout << buff;
However, when i add a second row:

Cpu 0 Temp: 30 C Cpu 1 Temp: 31 C Sys Temp: 30 C
HD Size: 20 G

my solution no longer works.
Any help would be appreciated.

Thanks

You can't do it using ANSI C++. You would need to refer to your C++
library and see if it provides any functions, like gotoxy() etc.

--
Imanpreet Singh Arora
@isingh@ AT @ACM@ DOT @ORG@
Jul 22 '05 #3
J.D
> You can't do it using ANSI C++. You would need to refer to your C++
library and see if it provides any functions, like gotoxy() etc.

Thanks for the heads up on gotoxy(), helped me find what i needed.
#include <graph.h>

_settextposition();
Seems to be able to do the trick, works in open watcom 1.2
Jul 22 '05 #4

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

Similar topics

0
by: Dimitre Novatchev | last post by:
You seem to be unaware of the xslt processing which uses the built-in rules in the absence of templates that match some selected node. http://www.w3.org/TR/xslt#built-in-rule According to the...
54
by: bnp | last post by:
Hi, I took a test on C. there was an objective question for program output type. following is the program: main() { char ch; int i =2;
22
by: Jaspreet | last post by:
I was recently asked this question in an interview. Unfortunately I was not able to answer it and the interviewer made a decision on my C strengths (or weekness) based on this single question and...
2
by: Bari Allen | last post by:
ASP Classic question: I have a Stored procedure in SQL, that works, when tested in SQL, with one input & several output parameters, as follows: CREATE PROCEDURE myProcedure @MyID int , @First...
24
by: kalamantina | last post by:
#include "stdafx.h" #include <stdio.h> #define output( x ) printf( #x "\r\n" );fflush( stdout ) class CMyBase { public: CMyBase() { output( CMyBase() ); f(*this);
32
by: spibou | last post by:
Is the output of the C preprocessor deterministic ? What I mean by that is , given 2 compilers which conform to the same standard, will their preprocessors produce identical output given as input...
1
by: Sathyaish | last post by:
I have the following scenario: Algorithm: 3DES Cipher Mode: CBC Key Size: 128-bit Block Size: 64 bit IV: 0x0000000000000000 (an eight byte array of zeros) The results I get using .NET with...
4
by: maria | last post by:
I only use C++ with Visual Studio 6.0 for string manipulations in thousands of HTML pages on my website. Many times, the output files of many of my C++ programs contain a spanish question mark (¿)...
14
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my windows applicationm, i need to excute a batch file. this batch file throws some text and questions to the screen, i need to catch the standard Output, check if it's a question, in...
2
by: Ken Fine | last post by:
I have a question about ASP.NET output caching. I want to use screen scraping as a temporary hack to pull in some complex Classic ASP-rendered content into some ASP.NET pages: protected String...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.