Thread: command: borland v. mvs

  1. #1
    Unregistered
    Guest

    command: borland v. mvs

    ok, so i've been working a nibbles program originally written in borland, but when i tried to compile it with mvs i came up with the error that "gotoxy()" was not indentified. so, i've been looking for a mvs version of such a function but i haven't found anything that remotely helps.

    if someone could tell me if there is, and what it is i'd be really greatful.

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    Code:
    The SetConsoleCursorPosition function sets the cursor position in the specified console screen buffer. 
    
    BOOL SetConsoleCursorPosition(
    
        HANDLE hConsoleOutput,	// handle of console screen buffer 
        COORD dwCursorPosition 	// new cursor position coordinates  
       );
    Parameters

    hConsoleOutput

    Identifies a console screen buffer. The handle must have GENERIC_WRITE access.

    dwCursorPosition

    Specifies a COORD structure containing the new cursor position. The coordinates are the column and row of a screen buffer character cell. The coordinates must be within the boundaries of the screen buffer.
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    or implement the nice winapi version of gotoxy() that Sunlight wrote ages ago and has existed in our FAQs since god was a boy - here

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    if you still wanted to use gotoxy() maybe this might work:

    Code:
    #include <windows.h>	// for other functions :)
    #include <conio.h>		//for getch()
    #include <iostream>		// for cout
    using namespace std;
    
    void gotoxy(short x, short y)
    {
    	COORD XY;
    
    	XY.X = x;
    	XY.Y = y;
    
    	SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), XY);
    }
    
    
    int main(int argc, char *argv[])
    {
    	gotoxy(10, 10);
    	cout << "WORKS?";
    	getch();
    
    	return 0;
    }
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  5. #5
    Registered User Liam Battle's Avatar
    Join Date
    Jan 2002
    Posts
    114
    consh = GetStdHandle(STD_OUTPUT_HANDLE);
    void gotoRC(int row, int col)
    {
    COORD coord;
    coord.X = col;
    coord.Y = row;
    SetConsoleCursorPosition(consh,coord);
    }



    that works 100%
    LB0: * Life once school is done
    LB1: N <- WakeUp;
    LB2: N <- C++_Code;
    LB3: N >= Tired : N <- Sleep;
    LB4: JMP*-3;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Config MVS to complie C
    By ph071 in forum C Programming
    Replies: 14
    Last Post: 12-04-2008, 12:30 PM
  2. MVS _asm
    By IceRay in forum C++ Programming
    Replies: 5
    Last Post: 05-21-2008, 02:35 AM