Commit 24342ee0 authored by Muhammad, Hammad's avatar Muhammad, Hammad

read file data

parent 25222367
Hello World !!! From the file
\ No newline at end of file
package main
import "fmt"
import (
"bufio"
"fmt"
"os"
)
func main() {
fmt.Println("Hello World !!!")
fileName := os.Args[1]
f, err := os.Open(fileName)
if err != nil {
fmt.Println("Error : ", err)
os.Exit(1)
}
defer f.Close()
scanner := bufio.NewScanner(f)
for scanner.Scan() {
fmt.Println(scanner.Text())
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment