Variable in the std::cout

#include < iostream >
static int myVariable = 42;
std::cout << “myVariable is 42” << std::endl;
provides “myVariable is 42" in Output Window of the Qspice schematic draw, but
std::cout << "myVariable is " << myVariable << std::endl;
provides an ‘abnormal program termination’ error message.

Someway to provide a variable value to the output window?

Hi, juanoboy.

That does seem curious. When you can upload (I think the privilege is granted pretty quickly), upload a simple *.cpp & *.qsch and I’ll check it out.

But to answer your question, the QSpice-generated display() function is really just printf() with delays. So:

int myVar = 42;
display("My variable is %d\n", myVar);

should work.

–robert

Edit: The display() function adds a 30ms delay before and after sending data to stdout (==cout) to try to keep from garbling/interleaving messages from multiple processes in the Output window. Note that this 60ms delay/msg can slow down simulations significantly and it doesn’t always prevent interleaving. Maybe the lack of a delay might be overrunning a buffer in QSpice and causing the abends…