Click here to Skip to main content
15,916,432 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: what is equivelent of Inet1.OpenURL in visual c++ 6 [modified] Pin
method00712-Jul-06 7:18
method00712-Jul-06 7:18 
GeneralRe: what is equivelent of Inet1.OpenURL in visual c++ 6 Pin
led mike12-Jul-06 8:22
led mike12-Jul-06 8:22 
GeneralRe: what is equivelent of Inet1.OpenURL in visual c++ 6 Pin
method00712-Jul-06 8:28
method00712-Jul-06 8:28 
GeneralRe: what is equivelent of Inet1.OpenURL in visual c++ 6 Pin
led mike12-Jul-06 9:05
led mike12-Jul-06 9:05 
GeneralRe: what is equivelent of Inet1.OpenURL in visual c++ 6 Pin
method00712-Jul-06 11:01
method00712-Jul-06 11:01 
GeneralRe: what is equivelent of Inet1.OpenURL in visual c++ 6 Pin
led mike12-Jul-06 12:11
led mike12-Jul-06 12:11 
GeneralRe: what is equivelent of Inet1.OpenURL in visual c++ 6 Pin
method00712-Jul-06 12:14
method00712-Jul-06 12:14 
QuestionUser Input revisted 2 [modified] Pin
Harold_Wishes12-Jul-06 5:02
Harold_Wishes12-Jul-06 5:02 
First, I thank those who provided their feedback from earlier post.
I need some tweaking once again

As stated earlier, I have a program that should accept only keyboard input of integers from 1 to 12.

Someone suggested I try the scanf() function. I did something with it as shown below. Currently, it allows all integers as valid input and no other characters (letters, punctuatation, symbols, ect . . .).

This is fine. But, how can I further restrict user input with the scanf() function to allow only integers 1 thru 12? Or should I use another method? This is my first time using scanf. I've already tried the while conditions
while (data >=0 || data <= 13), (data >=0 && data <= 13) 
with not much luck. At this point I'm not sure if I should change how I'm retrieving the data (thru cin or getline). This is a very pivotable part of the program and the whole program is dependent on this functionality. Help is appreciated. Smile | :)


char buff[1024];
	unsigned int value;
	int charsRead;

	bool validEntry = false;
	while (!validEntry)
	{ 
	    cout << "Please enter the number of subunits: ";
		cin.getline(buff, 1023, '\n');


        if (sscanf(buff, "%u%n",&value,&charsRead)==1)			
        validEntry = true;
	}


-- modified at 11:13 Wednesday 12th July, 2006
QuestionRe: User Input revisted 2 Pin
David Crow12-Jul-06 5:17
David Crow12-Jul-06 5:17 
AnswerRe: User Input revisted 2 [modified] Pin
Harold_Wishes12-Jul-06 5:39
Harold_Wishes12-Jul-06 5:39 
GeneralRe: User Input revisted 2 Pin
David Crow12-Jul-06 5:53
David Crow12-Jul-06 5:53 
GeneralRe: User Input revisted 2 [modified] Pin
Harold_Wishes12-Jul-06 6:12
Harold_Wishes12-Jul-06 6:12 
GeneralRe: User Input revisted 2 Pin
David Crow12-Jul-06 6:33
David Crow12-Jul-06 6:33 
GeneralRe: User Input revisted 2 Pin
Zac Howland12-Jul-06 10:12
Zac Howland12-Jul-06 10:12 
GeneralRe: User Input revisted 2 [modified] Pin
earl12-Jul-06 8:52
earl12-Jul-06 8:52 
GeneralRe: User Input revisted 2 [modified] Pin
Harold_Wishes12-Jul-06 10:04
Harold_Wishes12-Jul-06 10:04 
Questionpthread Pin
mehmetned12-Jul-06 4:55
mehmetned12-Jul-06 4:55 
AnswerRe: pthread Pin
toxcct12-Jul-06 4:58
toxcct12-Jul-06 4:58 
GeneralRe: pthread Pin
led mike12-Jul-06 5:02
led mike12-Jul-06 5:02 
AnswerRe: pthread Pin
David Crow12-Jul-06 4:58
David Crow12-Jul-06 4:58 
AnswerRe: pthread Pin
led mike12-Jul-06 5:05
led mike12-Jul-06 5:05 
AnswerRe: pthread Pin
Jun Du12-Jul-06 5:08
Jun Du12-Jul-06 5:08 
Questionoverzealous protection rules Pin
Dave Schumann12-Jul-06 4:53
Dave Schumann12-Jul-06 4:53 
AnswerRe: overzealous protection rules Pin
toxcct12-Jul-06 4:56
toxcct12-Jul-06 4:56 
GeneralRe: overzealous protection rules Pin
Dave Schumann12-Jul-06 5:02
Dave Schumann12-Jul-06 5:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.