Challenge: Decode the Contents
This lesson brings you a challenge to solve.
We'll cover the following
Problem statement
Write a program that reads in the file vcard.gob, decodes the contents and prints it. It’s the inverse of the program written in the previous lesson that encodes personal information of a person (first name, last name, address, and remark).
To read the file vcard.gob, simply write file, _ := os.Open("vcard.gob")
. The file is already present behind the project but isn’t visible.
Hint: Do not forget to import
bufio
,io
,encoding/gob
, andlog
packages.
Try to attempt the challenge below. Good Luck!
Get hands-on with 1400+ tech skills courses.