Terminal control/Dimensions: Difference between revisions

Go solution
m (Applesoft BASIC)
(Go solution)
Line 210:
[then]
term-width ! term-height !</lang>
 
=={{header|Go}}==
===External command===
<lang go>package main
 
import (
"fmt"
"os"
"os/exec"
)
 
func main() {
var h, w int
cmd := exec.Command("stty", "size")
cmd.Stdin = os.Stdin
d, _ := cmd.Output()
fmt.Sscan(string(d), &h, &w)
fmt.Println(h, w)
}</lang>
===Ncurses===
<lang go>package main
 
import (
"fmt"
"log"
 
"code.google.com/p/goncurses"
)
 
func main() {
s, err := goncurses.Init()
if err != nil {
log.Fatal("init:", err)
}
defer goncurses.End()
height, width := s.MaxYX()
fmt.Println(height, width)
}</lang>
 
=={{header|J}}==
1,707

edits