Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Prozessordaten auslesen in C

Empfohlene Antworten

Veröffentlicht

Kann mir jemand den sourcecode aufschreiben wie ich die Prozessordaten auslesen kann, damit ich das mal als beispiel hab und mir die anderen dinge die ich noch brauche ableiten kann. wäre echt nett.

bin nämlich noch C-newbie

Du hast das Betriebssystem vergessen.

1. WindowsNT/2000/XP? ( sollte auch unter 9x gehen)

Function NtQuerySystemInformation befindet sich im Header ntexapi.h.

Wie die Funktion benutzt wird, würde den Rahmen sprengen. Am besten, du schnuffelst mal durchs Netz.

2. Linux

Datei /proc/cpuinfo öffen (kann mit cat angezeigt werden) und auslesen.

#include <unistd.h>

#include <sys/stat.h>

#include <sys/types.h>

int

main()

{

int cpuInfo;

struct stat fileStatistik;

char* cpuInfoBuffer;

cpuInfo = open("/proc/cpuinfo", O_RDONLY);

if(cpuInfo == -1)

return 1;

if(fstat(cpuInfo, &fileStatistik) == -1){

close(cpuInfo);

return 1;

}

cpuInfobuffer = (char*) calloc(fileStatistik.st_size+1, 1);

if(!cpuInfoBuffer){

close(cpuInfo);

return 1;

}

if(read(cpuInfo, cpuInfoBuffer, fileStatistik.st_size) != fileStatistik.st_size){

close(cpuInfo);

return 1;

}

/*jetzt steht die Datei im Speicher und kann mit strtok, strstr, ... zerlegt werden.*/

close(cpuInfo);

free(cpuInfobuffer);

}

geholfen ?

Wenn du aber direkt an die CPU ran willst, hilft nur Assembler und ein gutes Buch und jede Menge Nerven.

Manitu

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.