sscanf() support for floating point values in shared projects

revvity truth

New member
As I understand it, by default the STL scanf() family of functions does not support floating point values due to the obvious limit of 8-bit processor architecture. There is a way to turn on this support by placing the following in setup():

Code:
asm(".global _scanf_float");

However, if the sscanf() call resides in a shared project, this appears to not have any effect. Is it possible to turn on this extended support in shared projects?

The unit tests for the shared project are all green, of course, because they are built using the Visual Studio C/C++ compiler.

Below is the code in question, if it helps:


C++:
#include "PumpCommandMessage.h"

PumpCommandMessage::PumpCommandMessage(string command) :
    CommandMessage(command)
{
    ParseCommand(command);

    _isValid = _isValid &&
        ValidateRange(PumpFrequency) &&
        ValidateRange(FlowRate) &&
        ValidateRange(TransferVolume) &&
        ValidateRange(StrokeVolume);
}

/// <summary>
/// Parse the specified command string, store the results in the appropriate local class fields and
/// validate its format.
/// </summary>
/// <param name="command"> - the command string to parse</param>
void PumpCommandMessage::ParseCommand(string command)
{
    _isValid = sscanf(command.c_str(), "%*d,%*d,%f,%f,%f,%d", &_pumpFrequency, &_flowRateOrTransferVolume, &_strokeVolume, &_flowDirection) == 4;
}
 
Last edited:
Back
Top