Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8325757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:32:45+00:00 2026-06-09T00:32:45+00:00

Sometimes i need to write things on a location of screen (ex: 10th column

  • 0

Sometimes i need to write things on a location of screen (ex: 10th column and 20th row). I searched on the net and found it is done with using windows handler which is using windows.h.

Yes, using handles are fast but somewhat complex so i wrote a class that uses only printf(string) and changes the string in a way that it fits to screen and every printf command fills the entire 80×24 console screen. The class imitates QBasic’s CLS , LOCATE x,y and PRINT commands.

Question: Is there a simpler way to reach any location in screen and put a char or a dot(drawing) without using windows handle or a slow class like mine?

here is sample output:

My QBASIC class is so slow that i can use it only several times per second.
VC++ 10.0 windows XP

Thanks for your time.

Here is my class and some examples:

// print_test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
class QBASIC
{
public:
QBASIC()
{
    for(int i=0;i<(80*23);i++)
    {
        default_fill[i]=' ';
        current_fill[i]=' ';
    }
    default_fill[80*23]=NULL;
    current_fill[80*23]=NULL;
    row=0;
    column=0;
    window_number=0;

}
void locate(int x,int y)
{
    row=y;
    column=x;
    return;
}
void print(char* text)
{
    int length=strlen(text);
    for(int i=0;i<length;i++)
    {
        current_fill[row*80+column+i]=text[i];
    }
    row++;
    column=0;
    printf("%s",current_fill);

    return;
}
void cls()
{
    for(int i=0;i<(80*24);i++)
    {
        current_fill[i]=default_fill[i];
    }
    column=0;
    row=0;
    printf("%s",current_fill);

}
void window(int x1,int y1,int x2,int y2,char*text,int id)
{
    //178 wall code
    window_buffer[window_number]=new unsigned char[1000];
    window_number++;
    for(int i=x1;i<(x2+1);i++)
    {
        current_fill[i+80*y1]=178;
        current_fill[i+80*y2]=178;

    }
    for(int j=y1;j<(y2+1);j++)
    {
        current_fill[x1+80*j]=178;
        current_fill[x2+80*j]=178;

    }
    int length=strlen(text);int temp_row=0;int temp_column=0;
    for(int i=0;i<length;i++)
    {
        if(current_fill[(x1+1+temp_column)+(y1+1+temp_row)*80+i]!=178)
        {
        current_fill[(x1+1+temp_column)+(y1+1+temp_row)*80+i]=text[i];
        }
        else
        {
            temp_row++;
            temp_column=-i;
            current_fill[(x1+1+temp_column)+(y1+1+temp_row)*80+i]=text[i];

        }

    }
    printf("%s",current_fill);
    return;
}
private:
unsigned char default_fill[80*23+1000];
unsigned char current_fill[80*23+1000];
int row,column;
unsigned char *window_buffer[10];//max windows number=10
int window_number;

};

int main()
{
QBASIC *mimic=new QBASIC();
mimic->cls();
mimic->locate(25,10);
mimic->print("x <--here is 26th column and 11th row");

mimic->locate(5,4);
mimic->print("x <--here is 6th column and 5th row");

mimic->locate(0,0);
mimic->print("x <--here is origin");


mimic->print("x <--here is sequantial print after");
mimic->print("x <--here is another");
int window_id_1=0,window_id_2=1;
mimic->window(20,5,28,9,"this is a window",window_id_1);
mimic->window(10,18,70,22,"this is another window from 10,18 to 70,22",window_id_2);


delete mimic;


getchar();// waiting to see the screen before exiting. press enter to continue
return 0;
}

i think theres no solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:32:47+00:00Added an answer on June 9, 2026 at 12:32 am

    Ok, I will continue using handles again.

    void LOCATE(int x, int y)
    {
      COORD newPosition = { x, y };
      HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleCursorPosition(h, newPosition);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes the good old tools still work best. In sed, I could write things
I'm trying to write a browser helper object.. and sometimes I need to return
I sometimes need to look for information for a special portion of code. When
I sometimes need to debug JS in other browsers, and it would be really
I sometimes need to run gacutil.exe or installutil.exe, etc. from the command line. Is
In my app I sometimes need to rebuild and repopulate database file. SQLite databse
In the form designer, I sometimes need to see the type of a property,
Sometimes I need to modify a third party library for my specific needs. It
Sometimes I need to find some strings inside DB usually it is just host-name
Sometimes you need to create a very simple single file application in Qt4. However

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.