FAQ
I'm trying to read a character from stdin without pressing return key,,

I know that in delay mode, the program will hang until the system passes
text through to the program.
depending on the setting of cbreak(), this will be after one character or
after the first newline.

so how could i change the cbreak settings or how could i do what i want ?

Search Discussions

  • Kyle Lemons at Sep 11, 2012 at 6:27 pm
    You need to put the terminal in raw mode. There are a number of packages
    that can do that. I wrote one called
    goat<http://go.pkgdoc.org/github.com/kylelemons/goat/term> (looks
    like it needs a -fix if you go get it), and I think there is at least one
    called GoTerm.

    In general, though, I don't recommend it, as it adds unnecessary
    platform-dependence to your binary.
    On Mon, Sep 10, 2012 at 5:46 PM, wrote:

    I'm trying to read a character from stdin without pressing return key,,

    I know that in delay mode, the program will hang until the system passes
    text through to the program.
    depending on the setting of cbreak(), this will be after one character or
    after the first newline.

    so how could i change the cbreak settings or how could i do what i want ?
  • Archos at Sep 11, 2012 at 7:33 pm
    Using "github.com/kless/terminal":

    term, err := terminal.New(0)
    if err != nil {
    // handle error
    }
    defer term.Restore()

    if err = CharMode(); err != nil {
    // handle error
    }

    Note: the API will be stable when I finish the Windows code.

    http://go.pkgdoc.org/github.com/kless/terminal

    El martes, 11 de septiembre de 2012 01:46:40 UTC+1, sra...@gmail.com
    escribió:
    I'm trying to read a character from stdin without pressing return key,,

    I know that in delay mode, the program will hang until the system passes
    text through to the program.
    depending on the setting of cbreak(), this will be after one character or
    after the first newline.

    so how could i change the cbreak settings or how could i do what i want ?
  • Archos at Sep 11, 2012 at 7:43 pm
    El martes, 11 de septiembre de 2012 20:32:58 UTC+1, Archos escribió:
    Using "github.com/kless/terminal":

    term, err := terminal.New(0)
    if err != nil {
    // handle error
    }
    defer term.Restore()

    if err = CharMode(); err != nil {

    // handle error
    }

    Note: the API will be stable when I finish the Windows code.

    http://go.pkgdoc.org/github.com/kless/terminal
    Sorry! You have in mind that CharMode is a method of Terminal, so it should
    be used term.CharMode() in the anterior code.

    El martes, 11 de septiembre de 2012 01:46:40 UTC+1, sra...@gmail.comescribió:
    I'm trying to read a character from stdin without pressing return key,,

    I know that in delay mode, the program will hang until the system passes
    text through to the program.
    depending on the setting of cbreak(), this will be after one character or
    after the first newline.

    so how could i change the cbreak settings or how could i do what i want ?

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 11, '12 at 4:14a
activeSep 11, '12 at 7:43p
posts4
users3
websitegolang.org

3 users in discussion

Archos: 2 posts Kyle Lemons: 1 post Srax47: 1 post

People

Translate

site design / logo © 2021 Grokbase