Click here to Skip to main content
15,923,006 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralANSWER: Reading Binary Files - file ptrs Pin
john john mackey30-Nov-01 5:44
john john mackey30-Nov-01 5:44 
GeneralCString question Pin
RobJones27-Nov-01 9:42
RobJones27-Nov-01 9:42 
GeneralRe: CString question Pin
john john mackey27-Nov-01 9:59
john john mackey27-Nov-01 9:59 
GeneralRe: CString question Pin
Tim Smith27-Nov-01 10:01
Tim Smith27-Nov-01 10:01 
GeneralRe: CString question Pin
Carlos Antollini27-Nov-01 10:05
Carlos Antollini27-Nov-01 10:05 
GeneralRe: CString question Pin
RobJones27-Nov-01 10:16
RobJones27-Nov-01 10:16 
GeneralRe: CString question Pin
Michael Dunn27-Nov-01 14:31
sitebuilderMichael Dunn27-Nov-01 14:31 
Generalswitch statement Pin
kpsr27-Nov-01 9:28
kpsr27-Nov-01 9:28 
Hi all!

I have enums defined in groups as shown below:
typedef enum myType
{

TYPE_UNKNOWN = 0,

// 1 - 19
TYPE_START = 1,
TYPE_OK,

// 20 - 99
TYPE_ERROR=20,
TYPE_BADDATA,
TYPE_BLAH

// 100 -- 199
TYPE_HELP1=100,
TYPE_HELP2,
TYPE_HELP3
}myType;

I want to use the switch statement which could break the above into certain range they fall in, instead of doing:
switch( nMyType )
{
case TYPE_UNKNOWN:
break;

case TYPE_START:
break;

case TYPE_ERROR:
case TYPE_BADDATA: // I dont want to list each and every case
// b'cause i will be having a lot of them at some point
break;

default:
break;
};

Rather, I am looking for something like:
switch( nMyType )
{

case TYPE_START to TYPE_OK: // ie. 1-19
// I will be calling appropriate routines to handle the explicit
// case
break;

case TYPE_ERROR to TYPE_BLAH:
break;

default:
break;
};

Currently I have a IF else condition for the above ranges, Just wondering can I have the range in a switch statement?

I'll appreciate any hint/help!

thx
kpsr
GeneralRe: switch statement Pin
Carlos Antollini27-Nov-01 9:36
Carlos Antollini27-Nov-01 9:36 
GeneralRe: switch statement Pin
kpsr27-Nov-01 10:31
kpsr27-Nov-01 10:31 
GeneralRe: switch statement Pin
Carlos Antollini27-Nov-01 11:16
Carlos Antollini27-Nov-01 11:16 
Generalgetting all filenames from a folder Pin
Kuniva27-Nov-01 8:40
Kuniva27-Nov-01 8:40 
GeneralRe: getting all filenames from a folder Pin
Chris Losinger27-Nov-01 8:53
professionalChris Losinger27-Nov-01 8:53 
GeneralRe: getting all filenames from a folder Pin
Carlos Antollini27-Nov-01 9:14
Carlos Antollini27-Nov-01 9:14 
GeneralMFC Beginner Pin
Nick Parker27-Nov-01 8:18
protectorNick Parker27-Nov-01 8:18 
GeneralRe: MFC Beginner Pin
Jon Sagara27-Nov-01 8:37
Jon Sagara27-Nov-01 8:37 
GeneralRe: MFC Beginner Pin
27-Nov-01 16:48
suss27-Nov-01 16:48 
GeneralRe: MFC Beginner Pin
Steen Krogsgaard28-Nov-01 1:45
Steen Krogsgaard28-Nov-01 1:45 
GeneralHandling MouseWheel Pin
Stephane Routelous27-Nov-01 7:38
Stephane Routelous27-Nov-01 7:38 
GeneralRe: Handling MouseWheel Pin
Stephane Routelous27-Nov-01 7:41
Stephane Routelous27-Nov-01 7:41 
QuestionCreateProcess() ??? Pin
27-Nov-01 7:26
suss27-Nov-01 7:26 
AnswerRe: CreateProcess() ??? Pin
Nish Nishant27-Nov-01 7:35
sitebuilderNish Nishant27-Nov-01 7:35 
QuestionCreateProcess() ??? Pin
27-Nov-01 7:24
suss27-Nov-01 7:24 
AnswerRe: CreateProcess() ??? Pin
Nish Nishant27-Nov-01 7:38
sitebuilderNish Nishant27-Nov-01 7:38 
GeneralCString formatting Pin
kpsr27-Nov-01 7:17
kpsr27-Nov-01 7:17 

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.