Guest User

Untitled

a guest
Jul 17th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. file, e := os.Open(path)
  2. if e != nil {...}
  3. defer file.Close()
  4.  
  5. fi, e := file.Stat()
  6. if e != nil {...}
  7. data, e := syscall.Mmap(int(file.Fd()), 0, int(fi.Size()), syscall.PROT_READ, syscall.MAP_SHARED)
  8. if e != nil {...}
  9.  
  10. slices := bytes.Split(data, []byte("||"))
  11. for _, s := range slices {
  12. str := string(s[:])
  13. fmt.Println(str)
  14. }
  15.  
  16. slices := bytes.Split(data, []byte("||"))
  17. s := slices[n - 1]
  18. str := string(s[:])
  19. fmt.Println(str)
Add Comment
Please, Sign In to add comment