我如何在C或C++的ole子上确定预想的位置?
我记得一项称为<代码>gotoxy(x,y)的职能,但我认为它已被删除。 是否有任何替代办法?
我如何在C或C++的ole子上确定预想的位置?
我记得一项称为<代码>gotoxy(x,y)的职能,但我认为它已被删除。 是否有任何替代办法?
http://msdn.microsoft.com/en-us/library/windows/desktop/ms6860 2528v=vs.85%29.aspx“rel=” SetConsoleCursorPosition。
在MSDN图书馆的同一部分有其他职能。 其中一些可能也是有用的。
无论是C还是C++,都没有任何屏幕或黄色的概念;它们只见到有内在特征的tes流。 有一些第三方的标语,如ncurses,以帮助你这样做。
如果你想要一个快速的解决方案和。 http://en.wikipedia.org/wiki/ANSI_efall_code”rel=“noreferer” ANSI 逃脱的顺序,那么你可以做这样的事情。
printf(" 33[%d;%dH", row, col);
将曲线移至专用行和栏目(顶部为{1,1})。 你们更能使用 n(或您的平台的等同)。
你们可以利用这一方法,把 cur子放在屏幕上的具体坐标上,然后简单地使用 co子和lt子;或打印文字说明,以印刷 con上的任何东西:
#include <iostream>
#include <windows.h>
using namespace std;
void set_cursor(int,int);
int main()
{
int x=0 , y=0;
set_cursor(x,y);
cout<<"Mohammad Usman Sajid";
return 0;
}
void set_cursor(int x = 0 , int y = 0)
{
HANDLE handle;
COORD coordinates;
handle = GetStdHandle(STD_OUTPUT_HANDLE);
coordinates.X = x;
coordinates.Y = y;
SetConsoleCursorPosition ( handle , coordinates );
}
如果你谈论ncurs 页: 1
我使用一种真正简单的方法。 如果你真心实意地转播青少年申请,那么你就不需要知道HANDLE的是什么,那么,一个COORD物体就在窗户的标准图书馆里,有两个成员的数据,X和Y. 0,0为左上角,Y为 down。 你们可以使用这一指挥系统,而只是继续使用:out和lt;印刷你们所需要的东西。
#include <windows.h>
int main(void){
//initialize objects for cursor manipulation
HANDLE hStdout;
COORD destCoord;
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
//position cursor at start of window
destCoord.X = 0;
destCoord.Y = 0;
SetConsoleCursorPosition(hStdout, destCoord);
}
这时段话正 on着......
`#include <stdio.h>
// ESC-H, ESC-J (I remember using this sequence on VTs)
#define clear() printf(" 33[H 33[J")
//ESC-BRACK-column;row (same here, used on terminals on an early intranet)
#define gotoxy(x,y) printf(" 33[%d;%dH", (y), (x))
int main(void)
{
clear();
gotoxy(23, 12);
printf("x");
gotoxy(1, 24);
return 0;
}`
Windows: #include<windows.h>
#define cursor(x, y) SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE), (COORD){x, y}
硫丹:
#33(%d;%dH)x, y
我用这个数字来描述 cur。
#include <iostream>
void setPos(std::ostream& _os, const std::streamsize& _x, const std::streamsize& _y)
{
char tmp = _os.fill();
if(_y>0) {
_os.fill(
);
_os.width(_y);
_os <<
;
}
if(_x>0) {
_os.fill( );
_os.width(_x);
_os << ;
}
_os.flush();
_os.fill(tmp);
}
int main(int argc, char **argv)
{
setPos(std::cout, 5, 5);
std::cout << "foo" << std::endl;
return 0;
}
做更多的工作需要假设决议或像ncurs。
I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...
I have been searching for sample code creating iterator for my own container, but I haven t really found a good example. I know this been asked before (Creating my own Iterators) but didn t see any ...
Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...
I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?
Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...
Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?