consoleStr

output a label and a custom string to the console.

Requires

#include "tiktag.h"

Definition

void consoleStr(const char* label, char* str);

Description

The consoleStr() outputs a label and a custom string to the console-output of your browser. It is typically used to look for bugs and see if a expected string-value is being displayed.

Parameters

label: A zero-terminated ASCII String Value (Label)

str: A zero-terminated ASCII String Value (custom String)

Return Value

void

Remarks

-

Example: manipulate a String coming from Javascript and display before and after values

main.js:

import {_wasmInitA, _strToCPP} from "./tt/ttWASM.js";
import wasm from "./web.wasm";

async function main()
{
	const wasmInstance = await _wasmInitA(wasm, {}, null);
	wasmInstance.exports.doStringOperation(_strToCPP("This is a Javascript String"));
}

main();

myCppExample.cpp:

#include "tiktag.h"

_export void doStringOperation(char* str)
{
	consoleStr ("The Original String from JS is: ", str);
	*str = 't';
	consoleStr ("After manipulation the String would be: ", str);
}

Output:

See Also

consoleLogconsoleNumconsoleHex