Explore BrainMass

Recognize Digit String Surrounded by Optional White Spaces

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Char line [MAXLINE];
int error,;
do {
printf("Input a positive integer: ");
fgets(line, MAXLINE,stdin);
error=sscanf(line,"%d",&n) !=1II n<=0;
printf("|nERROR:Do it again.n");
} while(error);

© BrainMass Inc. brainmass.com October 24, 2018, 8:23 pm ad1c9bdddf

Solution Preview

I assume that you do it in C (so the code looks).

An example of how to modify the code to do what you request is given below.

In case you do it in Visual Studio, I also attach a whole VS6 project in the zip file (it can easily be modified for VS7 and VS8, if needed).
It is worth to look into it in any case, as some of the characters used in ...