Advertisement
Guest User

Untitled

a guest
Feb 7th, 2012
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "os"
  6.  
  7.     "github.com/edsrzf/mmap-go"
  8.     )
  9.  
  10. func main() {
  11.     n := 1000
  12.     t := 32 * n
  13.  
  14.     map_file, _ := os.Create("/tmp/test.dat")
  15.     _, _ = map_file.Seek(int64(t - 1), 0)
  16.     map_file.Write([]byte(" "))
  17.     defer map_file.Close()
  18.  
  19.     mmap, _ := mmap.Map(map_file, mmap.RDWR, 0)
  20.  
  21.     for i := 0; i < n; i++ {
  22.         mmap[i] = byte(i*i)
  23.     }
  24.  
  25.     fmt.Println(mmap)
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement