Converting float32 to char[255] using Ansys Scade Suite

  ansys, c++, embedded

I’m trying to convert a float32 to char[255] in Ansys Scade Suite. I’m using a custom function here that’s taking in a float32 input and outputting a char array of 255. It can be seen below.

#include <stdlib.h>
#include "kcg_types.h"

kcg_char OP_StringToFloat(
    /* string/ */  const kcg_float *d
 )
{

kcg_char a[255];
sprintf(a, "%f", d);
return a;
}

kcg_char is a char.

For some reason the custom function is crashing the program leaving an untraceable System Error (SYSERR). Can anyone who uses Scade Suite help me out? This is model based programming btw. Here’s how the connection look.
Model

Source: Windows Questions C++

LEAVE A COMMENT