Base64 encode data: Difference between revisions
Content added Content deleted
mNo edit summary |
|||
Line 2,261: | Line 2,261: | ||
Result of string comparison of input and decoded output: 0. |
Result of string comparison of input and decoded output: 0. |
||
A zero indicates both strings are equal.</pre> |
A zero indicates both strings are equal.</pre> |
||
=={{header|V (Vlang)}}== |
|||
<syntaxhighlight lang="Zig"> |
|||
import net.http |
|||
import encoding.base64 |
|||
import os |
|||
fn main() { |
|||
resp := http.get("http://rosettacode.org/favicon.ico") or {println(err) exit(-1)} |
|||
encoded := base64.encode_str(resp.body) |
|||
println(encoded) |
|||
// Check if can decode and save |
|||
decoded := base64.decode_str(encoded) |
|||
os.write_file("./favicon.ico", decoded) or {println("File not created or written to!")} |
|||
} |
|||
</syntaxhighlight> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |