?
Solved

Simple example using SYSTEM_INFO in C++

Posted on 2003-02-21
8
Medium Priority
?
884 Views
Last Modified: 2010-05-18
Can someone share me with some simple examples using SYSTEM_INFO in C++.  I just need a simple way in C++ to returns me the level of the CPU.

Thanks,

Lik
0
Comment
Question by:lik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 7994960
What do you mean by the 'level of the CPU'? If you mean 'wProcessorLevel', you'd use

SYSTEM_INFO si;

GetSystemInfo ( &si);

switch ( si.wProcessorLevel) {
 
case 3: // x386
  break;
case 4: // x486
  break;
case 5: // Pentium
  break;
}

0
 

Author Comment

by:lik
ID: 7995427
Thanks, jkr.

I found the SYSTEM_INFO from the MSDN, and know the code you provided will do the job.  The problem I have is I don't know what to header information include to use SYSTEM_INFO.  I searched the books and the internet, but just could not find any more information regarding this.  Can you help me more?

Thanks,
0
 

Author Comment

by:lik
ID: 7995671
Thanks, jkr.

I found the SYSTEM_INFO from the MSDN, and know the code you provided will do the job.  The problem I have is I don't know what to header information include to use SYSTEM_INFO.  I searched the books and the internet, but just could not find any more information regarding this.  Can you help me more?

Thanks,
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lik
ID: 7996000
I just figured out I need to @include <windows.h>

Thanks for all you pros for the help :)
0
 
LVL 86

Accepted Solution

by:
jkr earned 150 total points
ID: 7997021
Thanks, great :o)

So, could we move this to the PAQs - unless you have further questions?
0
 

Author Comment

by:lik
ID: 8010122
Sure. This case is close :)

Thanks,
0
 
LVL 86

Expert Comment

by:jkr
ID: 8010160
>>Sure. This case is close :)

Well, actually, on EE questions are closed by selecting one of the comments as the answer... :o)
0
 

Author Comment

by:lik
ID: 8010265
Helped with SYSTEM_INFO
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question