sscanf - error: invalid use of non-static member function

Status
Not open for further replies.

truth

Member
Why am I getting error 46: error: invalid use of non-static member function for what seems to be an simple use of sscanf?
If it is pertinent, I'm using the Visual Micro Arduino IDE in Visual Studio Pro 2107.

Code:
void valveCommandHandler(const String& inString)
{
	u_char index;
	char cmd;

	sscanf(inString.c_str, "%d%c", &index, &cmd);

	switch (cmd)
	{
	case 'o':
		valves[index].open();
		Serial.printf("Valve %d opened\n", index);
		break;
	case 'x':
		valves[index].close();
		Serial.printf("Valve %d closed\n", index);
		break;
	case 's':
		Serial.printf("Valve %d: %s\n", index, (valves[0].getState()) ? "Open" : "Closed");
		break;
	default:
		break;
	}
}
 
Why am I getting error 46: error: invalid use of non-static member function for what seems to be an simple use of sscanf?
If it is pertinent, I'm using the Visual Micro Arduino IDE in Visual Studio Pro 2107.

Code:
void valveCommandHandler(const String& inString)
{
	u_char index;
	char cmd;

	sscanf(inString.c_str, "%d%c", &index, &cmd);

	switch (cmd)
	{
	case 'o':
		valves[index].open();
		Serial.printf("Valve %d opened\n", index);
		break;
	case 'x':
		valves[index].close();
		Serial.printf("Valve %d closed\n", index);
		break;
	case 's':
		Serial.printf("Valve %d: %s\n", index, (valves[0].getState()) ? "Open" : "Closed");
		break;
	default:
		break;
	}
}

Needless to say, thank you.

I'm so ashamed...:eek::mad:
I knew it was something obvious.:cool:
I can only blame lack of sleep...
I swear I can hear you snickering...;)

ADMIN: please remove this post as it is embarrassing, unless of course it could prove useful to some other idiot
 
Status
Not open for further replies.
Back
Top