Hirdetés

Új hozzászólás Aktív témák

  • Benmartin
    senior tag

    Hát nem nagyon bírom életrekelteni. :U
    Ha beleraktam a windows.h/wincon.h-t akkor sem ment.

    #include <stdlib.h>
    #include <conio.h>
    #include <stdlib.h>

    main() {
    char x="3";

    SetConsoleCursorPosition(2,2);
    printf("%c",x);
    getch();
    }

    szia!

    wincon.h-hoz szükséges windows.h, char != char*, azért x = '3'. SetConsoleCursorPosition() fvnek nem csak header kell, hanem library is(kernel32). valamint nem két int a paramétere, hanem:

    BOOL WINAPI SetConsoleCursorPosition(
    __in HANDLE hConsoleOutput,
    __in COORD dwCursorPosition
    );

    ennek megfelelően így alakul a kód:

    #include <stdio.h>
    #include <conio.h>
    #include <windows.h>
    #include <wincon.h>
    main() {
    COORD kord;
    HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    kord.X = 2;
    kord.Y = 3;
    char x = '3';
    SetConsoleCursorPosition(hConsoleOutput,kord);
    printf("%c",x);
    getch();
    }

Új hozzászólás Aktív témák