read terminal then output as text file...oooo

This commit is contained in:
bobbert committed 2026-07-17 01:40:34 +01:00
1 parent b55e4c503f
commit 757fc804ac
2 files changed
+31

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
package main
import (
"bufio"
"fmt"
"os"
"path/filepath"
)
func main() {
reader := bufio.NewReader(os.Stdin)
fmt.Println("To end the output Write . and then click enter")
fmt.Print("Enter text to write to file a file called \"OutputFromTerminal.txt\": \n")
input, _ := reader.ReadString('.')
path := filepath.Join("./", "OutputFromTerminal.txt")
file, _ := os.Create(path)
writer := bufio.NewWriter(file)
writer.WriteString(input)
defer file.Close()
defer writer.Flush()
}
+3
View File
@@ -0,0 +1,3 @@
package main
func main() {}