Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

display an item at a specific location

Posted on 2000-04-07
4
Medium Priority
?
186 Views
Last Modified: 2010-04-02
In C, how do I print something at a specific location?
eg;
printf("XXX");

I want XXX to be displayed on the current line(not named), at row 22.  
0
Comment
Question by:sima1980
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Expert Comment

by:gelbert
ID: 2694428
Which OS? If it is Windows then use TextOut()
0
 
LVL 22

Expert Comment

by:nietod
ID: 2694475
Standard C++ provides no features for controling how output is displayed.  In fact, standard C++ doesn't even assume that the output is going to am monitor,  It coudl be going to a file, a com device, etc.  So you have to resort to OS-specific and/or hardware-specific techniques to do this.

That is why we need to know what OS this is for--like gelbert asked.

If this is for a windows console program, you want to use WriteConsole() to do this.  You also might want to see if your compiler has the non-stadnard gotoxy() function in its library.  it is not part of standard C++, but many compilers do include it.
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 150 total points
ID: 2695824
Most of compliers support
gotoxy(x,y) function. (But , of cource, not Win32 GUI!). Next is an example:
/* gotoxy example */

#include <conio.h>

int main(void)
{
    clrscr();
    gotoxy(35, 12);
    cprintf("Hello world");
    getch();
    return 0;
}
Borland C++ 5.0 Programmer's Guide
I hope, it helps. Alex
0
 
LVL 22

Expert Comment

by:nietod
ID: 2695926
>> Most of compliers support
I wouldn't say most.  I would say "Borland".  I don't know of any non-borland C/C++ compiler that supports gotoxy().
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

604 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