Daemon Painter
Daemon Painter

Reputation: 3500

CAPL for writing to file not working in offline mode

I wrote a simple CAPL program to output data to a file.

When executing simulation in offline mode, nothing gets printed on file. I can't test it in online mode. I can't understand why.

Script is put in measurement setup right after the online/offline switch, on the main branch. I'm using CANoe.

/*@!Encoding:1252*/
includes
{

}

variables
{
    dword fileHandle;
    char buffer[1024];
}

on preStart
{
    setFilePath("mypath");
    fileHandle = openFileWrite("file.txt", 2);
}

on stopMeasurement
{
    fileClose(fileHandle);
}

on linFrame someFrame
{
    snprintf(buffer, elcount(buffer), "somestring %d", somevalue);
    filePutString(buffer, elcount(buffer), fileHandle);
}


Upvotes: 1

Views: 2073

Answers (2)

ExarGonSith
ExarGonSith

Reputation: 1

If I use filePutString(buffer, elcount(buffer), fileHandle); soon I encounter issues with the size of the buffer & the program crashes.

Using WriteLineEx(file_link, type_of_logging, out_string) worked like a charm.

Upvotes: 0

maslovw
maslovw

Reputation: 119

Sadly, but The Simulation Setup is not active in offline mode. Test Setup is not displayed.

Taken from help doc: Measurement Setup >> Online/Offline Mode >> Offline

Upvotes: -1

Related Questions