0

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

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by skatamatic
0

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 + " ";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.