aboutsummaryrefslogtreecommitdiffhomepage
path: root/notes/strings_binary.txt
blob: 44f4b8cdfaa947f46344733893cb45bd3814845e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

Binary string literals
======================

Sometimes it is necessary to include binary data in the source code.
In other languages such as Java, this is often done by using some
tool to convert the binary file to source code (a byte array with
integer literals).

There are better ways to do this:
1. base64 / base64url encoded literals.
2. resources, defined in the module header, and referenced in the source
   code.


Example syntaxes of base64/base64url encoded literals:

    string s = b64url"aGVsbG8K"
    string s = "\b64{aGVsbG8K}"   # allows mixing text and binary

Example of resources:

    \file res1 file.bin

    string s = res1