[C / C ] Gotoxy() in Dev-C – Gotoxy in Dev-C
In Dev-C default content gotoxy(x, and). We need to build it using the library windows.h as follows:
void gotoxy(int x, int y) { static HANDLE h = NULL; if(!h) h = GetStdHandle(STD_OUTPUT_HANDLE); COORD c = { x, y }; SetConsoleCursorPosition(h,c); }
CEO:
#include <stdio.h> #include <windows.h> void gotoxy(int x, int y) { static HANDLE h = NULL; if(!h) h = GetStdHandle(STD_OUTPUT_HANDLE); COORD c = { x, y }; SetConsoleCursorPosition(h,c); } int main(){ char *s = "nguyenvanquan7826"; gotoxy(40 - strlen(s)/2, 1); printf("%snn", s); }
how to save your user forever, her new workout to relearn the loop portion having this function and textcolor but no function. I easily found the building to do but do not know how to be able to recall the need for facilities. Your guide to all his or her household reference reading is also.
Welcome, You can create your own library to copy the folder include. See instructions at Create a library of C - Create a library in C
#ifndef __gotoxy_H__
#define __gotoxy_H__
#include
void gotoxy(int x, int y)
{
static HANDLE h = NULL;
if(!h)
h = GetStdHandle(STD_OUTPUT_HANDLE);
COORD c = { x, and };
SetConsoleCursorPosition(h,c);
}
#endif
you copy the saved on gotoxy.h
finished copying the files into it on …MinGW64\include\
next time, just beneath #include called gotoxy(…, …); is DC
#include the windows.h under #define is nhé
Do you have any function can read / write the characters on the console does not ?
Example: want to read the letters in the box (2,3) then we call GetCharXY(2,3) also in characters box indicates (2,3) then we call PutCharXY(ch,2,3)
Separate read on-screen characters are sure not to be. And then you goto to burn and print it as normal…
the putchar
void PutCharXY(int x, int y, char* KyTu){
gotoxy(x, and);
printf(had to say on);
}
the getchar shall bear
You can explain to her about the order in which content is not?
Several command to calculate your position need only. Also, I do not know specifically because it is the system.
Hello ! I wonder spot% SNN reviews. It does this specification as sir. I google but it's not the desired result
Ah make that place his defective code to change blog. it is% s n n. Print string and newline.
void gotoxy(int x, int y){
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),{x,and});
}
Compact withdrawn
Thank you.