Visualizzazione dei risultati da 1 a 7 su 7

Discussione: [C] Gotoxy sotto Linux

  1. #1

    [C] Gotoxy sotto Linux

    Come faccio a simulare la gotoxy() sotto linux ?
    #include <stdio.h>
    int main() { char m[18+1] = "_TeYS_We2^[TWda [f";
    int i = (((3*7))-21); for (; m[i]; i++)
    (i<27) ? m[i]+=(((13)*3)-25) : m[i] -= (7+(i)*(-1));
    puts(m); getchar(); return 0; };

  2. #2
    Utente di HTML.it L'avatar di pdpmpd
    Registrato dal
    Jan 2003
    Messaggi
    448
    ci sono due modi:
    1) usi le librerie curses (ncurses)
    2) usi i caratteri di fuga VT100

    nb. il metodo dei caratteri di fuga vt100 funziona solo sui terminali compatibili vt100
    Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.

  3. #3
    come si usano le librerie ncursers
    #include <stdio.h>
    int main() { char m[18+1] = "_TeYS_We2^[TWda [f";
    int i = (((3*7))-21); for (; m[i]; i++)
    (i<27) ? m[i]+=(((13)*3)-25) : m[i] -= (7+(i)*(-1));
    puts(m); getchar(); return 0; };

  4. #4
    Utente di HTML.it L'avatar di pdpmpd
    Registrato dal
    Jan 2003
    Messaggi
    448
    dovresti leggerti l'ncurses howto (lo trovi sul sito del Linux Documentation Project) perché è un po' lungo da spiegare.

    per la par condicio:
    sposta il cursore con i caratteri di fuga VT100
    codice:
    printf("\033[%d;%df",y,x);
    dove y e x sono le coordinate (riga, colonna).
    Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.

  5. #5
    Grazie...
    #include <stdio.h>
    int main() { char m[18+1] = "_TeYS_We2^[TWda [f";
    int i = (((3*7))-21); for (; m[i]; i++)
    (i<27) ? m[i]+=(((13)*3)-25) : m[i] -= (7+(i)*(-1));
    puts(m); getchar(); return 0; };

  6. #6
    Utente di HTML.it L'avatar di pdpmpd
    Registrato dal
    Jan 2003
    Messaggi
    448
    Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.

  7. #7
    ...Terrible warlords, good warlords, and an english song

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.