Skip to content

Commit

Permalink
resolved conflicts in strings.go file
Browse files Browse the repository at this point in the history
  • Loading branch information
Himanshuxone committed Oct 31, 2016
2 parents 874a07d + a5b23a9 commit b7eb3a7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions iofile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

import(
"fmt"
"os"
"log"
"io/ioutil"
)

func main() {

file, err := os.Create("sample.txt")

if err != nil {
log.Fatal(err)
}

// write to a text file
file.WriteString("This is a random text")

file.Close()

// read teh created file

stream, err := ioutil.ReadFile("sample.txt")

if err != nil {
log.Fatal(err)
}
// convert the file in bytes to string
readString := string(stream)

fmt.Println(readString)
}
1 change: 1 addition & 0 deletions sample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a random text

0 comments on commit b7eb3a7

Please sign in to comment.