gotoxy function

Dec 18, 2013 at 7:13pm
help me in explaining this ....
1
2
3
4
void gotoxy(short x, short y) {
COORD pos = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
Dec 18, 2013 at 7:36pm
also q_f what is this used for????


system("cls");
question q_f=q.GetQuizQuestions();
Dec 18, 2013 at 7:49pm
This is a command function to set the cursors position on the command line using the Windows API based on the two short integers that you pass it. The integers are used to set the values inside of the 'COORD' struct and that struct is used as an argument to the "SetConsoleCursorPosition()" function.

- COORD: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682119(v=vs.85).aspx

- SetConsoleCursorPosition(): http://msdn.microsoft.com/en-us/library/windows/desktop/ms686025(v=vs.85).aspx

- GetStdHandle(): http://msdn.microsoft.com/en-us/library/windows/desktop/ms683231(v=vs.85).aspx

The "system()" function is from the cstdlib header file and it simply relays the text argument that you feed it to the shell that it is running inside of. In this case the text command "cls" is a built in shell command for Microsofts default command line interface. It clears the screen.

- system(): http://www.cplusplus.com/reference/cstdlib/system/

- cls: http://technet.microsoft.com/en-us/library/bb490879.aspx


EDIT: That last line is code that is specific to what ever project you are grabbing this stuff from.
Last edited on Dec 18, 2013 at 7:53pm
Dec 18, 2013 at 7:54pm
question q_f=q.GetQuizQuestions();

^kindly do explain the work of _f <-- in it
Dec 18, 2013 at 8:04pm
The variable "q_f" is an instance of the 'question' data type. The underscore is just part of the variables name, it isn't an operator.
Last edited on Dec 18, 2013 at 8:04pm
Topic archived. No new replies allowed.