Skip to content

Instantly share code, notes, and snippets.

@serkanalgur
Created November 25, 2020 20:46
Show Gist options
  • Save serkanalgur/ab822aec27e030f9fd18f93b14b1ec60 to your computer and use it in GitHub Desktop.
Save serkanalgur/ab822aec27e030f9fd18f93b14b1ec60 to your computer and use it in GitHub Desktop.
Open and Read File using phpfuncs module
package main
import (
"fmt"
"os"
"github.com/serkanalgur/phpfuncs"
)
func main(){
var path = "/path/to/filename.extension"
// FOpen - func FOpen(file string, mode int) (*os.File, error)
f, _ := phpfuncs.FOpen(path,os.O_RDWR)
// FRead - func FRead(f *os.File, sb int64) string
fmt.Print(phpfuncs.FRead(f,512))
// FClose - func FClose(file *os.File) error
phpfuncs.FClose(f)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment