Unicorn with delicious cookie
Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus
Accepter
to the top
>
>
How can I find out in Win64 how many pr…

How can I find out in Win64 how many processor cores there are in the system?

11 Mar 2012
Author:

To get information about the number of processor cores in the system, you may use the Windows environment variable NUMBER_OF_PROCESSORS. Below is a fragment of C++ code where the WinAPI GetEnvironmentVariable method is used to extract and display the contents of this environment variable.

#include <windows.h>
#include <tchar.h>
#include <stdio.h>

#define VARNAME TEXT("NUMBER_OF_PROCESSORS")
#define BUFSIZE 4096

int main()
{
  TCHAR buf[BUFSIZE];
  DWORD dwRet = GetEnvironmentVariable(VARNAME, buf, BUFSIZE);
  if (dwRet > 0 && dwRet < BUFSIZE)
    _tprintf(_T("Number of processors: %s\n"), buf);

  return 0;
}

References

Popular related articles

S'abonner

Comments (0)

close comment form
close form

Remplissez le formulaire ci‑dessous en 2 étapes simples :

Vos coordonnées :

Étape 1
Félicitations ! Voici votre code promo !

Type de licence souhaité :

Étape 2
Team license
Enterprise licence
** En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité
close form
Demandez des tarifs
Nouvelle licence
Renouvellement de licence
--Sélectionnez la devise--
USD
EUR
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
La licence PVS‑Studio gratuit pour les spécialistes Microsoft MVP
close form
Pour obtenir la licence de votre projet open source, s’il vous plait rempliez ce formulaire
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
I want to join the test
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
check circle
Votre message a été envoyé.

Nous vous répondrons à


Si l'e-mail n'apparaît pas dans votre boîte de réception, recherchez-le dans l'un des dossiers suivants:

  • Promotion
  • Notifications
  • Spam