I'm looking for some help resolving the following warning...

warning: format ‘%c’ expects type ‘char*’, but argument 6 has type ‘char (*)[128]’

char data [ BLOCK_SIZE ];
sscanf ( inBuf, "%c %c %c %c", &mode, &c, &s, &data );

essentially what happens is inBuf is a 'string' and I want mode, c, s and data to be what's in it.

'data' complains. Can someone help me fix it.

Thanks

drjay

I'm looking for some help resolving the following warning...

warning: format ‘%c’ expects type ‘char*’, but argument 6 has type ‘char (*)[128]’

char data [ BLOCK_SIZE ];
sscanf ( inBuf, "%c %c %c %c", &mode, &c, &s, &data );

essentially what happens is inBuf is a 'string' and I want mode, c, s and data to be what's in it.

'data' complains. Can someone help me fix it.

Thanks

drjay

Do you have to use sscanf? That's a bit outdated and not generally used, and MSC++ throws a bunch of warnings when you use it. I sugguest using string datatype with operator+()

Usage:

//Header
#include<string>

//implementation
string a, b, c, d;
d = a + " " + b + " " + c + " ";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.