befehl zum lesen von der konsole



  • hi,
    ich bin auf der suche nach einem befehl, mit dem ich das, was ich mit cout in meine konsole geschrieben habe wieder einlesen kann. gibt es so einen befehl? am besten so einer, mit dem man einen einzelnes zeichen einlesen kann ( getxy z.b.)
    THX

    MfG Kenny



  • Hi!

    Also du könntest es damit probieren:

    void main()
    {
    int eingabe; //Variable evt. mit char benutzen
    cout<<"Bitte Zahl eingeben: ";
    cin>>eingabe;
    cout<<"Sie haben"<<eingabe<<"eingegeben";
    return 0;
    }
    

    Iostream nicht vergessen! Hoffe es sind keine syntax-Fehler drin! *gähn*

    Hoffe ich konnte helfen 🙂

    Dead Body



  • http://www.delorie.com/djgpp/doc/libc/libc_392.html#SEC392

    damit kommst du weiter, wenn du den djgpp benutzt als compiler...

    @dead body
    thema verfehlt?



  • @elise

    Wieso Thema verfehlt? Das ist doch das was er gesucht hatte

    das, was ich mit cout in meine konsole geschrieben habe wieder einlesen kann

    😕 😕 😕

    Vieleicht ist es auch schon spät und ich realisiere meine Unwissenheit erst morgen?



  • Dead Body schrieb:

    Wieso Thema verfehlt? Das ist doch das was er gesucht hatte

    das, was ich mit cout in meine konsole geschrieben habe wieder einlesen kann

    Er wollte etwas, das er mit cout in seine konsole geschrieben hat, wieder einlesen. Du hast ihm aber gezeigt wie er etwas, was über die Tastatur eingegeben wird, einliest.



  • Quelle: Borland 5.02 Hilfe

    Syntax

    #include <conio.h>
    int gettext(int left, int top, int right, int bottom, void *destin);

    Description

    Copies text from text mode screen to memory.
    gettext stores the contents of an onscreen text rectangle defined by left, top, right, and bottom into the area of memory pointed to by destin.
    All coordinates are absolute screen coordinates not window-relative. The upper left corner is (1,1). gettext reads the contents of the rectangle into memory sequentially from left to right and top to bottom.
    Each position onscreen takes 2 bytes of memory: The first byte is the character in the cell and the second is the cell's video attribute. The space required for a rectangle w columns wide by h rows high is defined as

    bytes = (h rows) x (w columns) x 2

    Note: Do not use this function for Win32s or Win32 GUI applications.

    Return Value

    gettext returns 1 if the operation succeeds.
    On error, it returns 0 (for example, if it fails because you gave coordinates outside the range of the current screen mode).



  • thx 🙂 habt mir weitergeholfen 👍

    MfG Kenny


Anmelden zum Antworten