Jordanwb
March 22nd, 2012, 02:22 AM
This is my program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void)
{
FILE *f = fopen ("/proc/cpuinfo", "r");
char *a = malloc (256);
char *b = malloc (128);
char *c = malloc (128);
while (!feof (f))
{
fgets (a, 512, f);
if (strlen (a) == 1) continue;
sscanf (a, "%[^\t:] : %[^\t\n]", b, c);
printf ("%s = %s\n", b, c);
}
fclose (f);
}
This is my desktop machine's cpuinfo: http://pastebin.com/0nk6WfHN
This is my NAS's cpuinfo: http://pastebin.com/ct82bBtU
If I run my program on the NAS, it runs fine although the Serial line is printed twice for some reason. If I run this on my desktop it handles everything okay but prints "power management = 36 bits physical, 48 bits virtual" twice then segfaults and I don't know why.
Thanks in advance.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void)
{
FILE *f = fopen ("/proc/cpuinfo", "r");
char *a = malloc (256);
char *b = malloc (128);
char *c = malloc (128);
while (!feof (f))
{
fgets (a, 512, f);
if (strlen (a) == 1) continue;
sscanf (a, "%[^\t:] : %[^\t\n]", b, c);
printf ("%s = %s\n", b, c);
}
fclose (f);
}
This is my desktop machine's cpuinfo: http://pastebin.com/0nk6WfHN
This is my NAS's cpuinfo: http://pastebin.com/ct82bBtU
If I run my program on the NAS, it runs fine although the Serial line is printed twice for some reason. If I run this on my desktop it handles everything okay but prints "power management = 36 bits physical, 48 bits virtual" twice then segfaults and I don't know why.
Thanks in advance.