header file related to goto

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ASIFSHEHZAD25
    New Member
    • Jan 2013
    • 5

    header file related to goto

    Can anybody tell me which header file is used to define "gotoxy" in microsoft visual studio?
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    You use conio.h.

    Be aware that this is not a standard function. In fact, everything in conio.h is really stuff peculiar to the Borland compiler so I recommend not using any of it.

    Any sort of go-to programming is discouraged.

    Comment

    • divideby0
      New Member
      • May 2012
      • 131

      #3
      In VS, windows.h has some console related functions. They're sort of involved though. here's a reference to some of them.

      Code:
      string s = "some string to display";
      HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
      COORD curpos = { (80 - s.length()) / 2, 12 }; // x and y
      
      SetConsoleCursorPosition(hcon, curpos);
      cout << s << "\n";

      Comment

      Working...