00:00 In this example application, I'm calling a console.log function within the main function of my C application. This function takes two arguments and offsets into the WebAssembly memory, which is the first character of the string that I have defined, and then the length in that memory, the length of the string.
00:32 We're reading raw data from WebAssembly memory. What if we wanted to write into WebAssembly memory? As an example, I'm going to consider a function to_lower_case, where we take an input string and we then output an output string that is the lowercase version of it.
00:48 We're going to have two strings here and I'm going to say that they're both 20 characters long. In the to_lower_case function, we can now loop over each character of the string. We read the character value from the input string, and we can then check if it's a capital letter based on the ASCII range.
01:04 This is much faster with bitwise arithmetic, but for clarity we can just check if it's between the 65 to 90 range in ASCII. If it's in that range, we then just shift it. Once we've got the results in lowercase character, we set that into the output string.
02:31 To write to the WebAssembly memory, we're going to create another buffer, which represents that input string, "WebAssembly memory." We're going to generate it from the WebAssembly memory buffer at the offset of that input string that was passed.
02:43 We're also going to set it to the length of the buffer that we've just created, that we're going to write into it. Looping through each byte index in the string buffer, we can then set into the out buffer, which represents that input string in WebAssembly memory, set each byte from that string buffer.