Last active
December 12, 2015 08:48
-
-
Save jamesadney/4746481 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "bytes" | |
import "io" | |
var msg = []byte("Hello World this is James") | |
func main() { | |
cipherText := bytes.NewBuffer(make([]byte, 0, len(msg)+16)) | |
cipherText.Write([]byte("Hey")) | |
fmt.Println(cipherText.Bytes()) | |
msgReader := bytes.NewReader(msg) | |
m_1 := make([]byte, 4) | |
m_2 := make([]byte, 4) | |
io.ReadFull(msgReader, m_1) | |
io.ReadFull(msgReader, m_2) | |
fmt.Println(string(m_1)) | |
fmt.Println(string(m_2)) | |
// Looping through bufio.Reader | |
// r := bufio.NewReader(file) | |
// for line, _, err := r.ReadLine(); err != io.EOF { | |
// // ... | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment