int c, s;

sscanf ( inBuf, " %d %d", &c, &s );

I wanna check if c and s are actually int.

suppose if you enter a letter rather than a number, how do i check?

drjay

int c, s;

sscanf ( inBuf, " %d %d", &c, &s );

I wanna check if c and s are actually int.

suppose if you enter a letter rather than a number, how do i check?

drjay

Fortunately, it's so simple:

if (sscanf(....) == 2) { // that's OK, 2 fmt specifiers processed
...
} else {
   // we have some problems...
}

thanks!

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.