gotoxy function

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);
}
also q_f what is this used for????


system("cls");
question q_f=q.GetQuizQuestions();
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
question q_f=q.GetQuizQuestions();

^kindly do explain the work of _f <-- in it
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
Topic archived. No new replies allowed.