I would like to verify the serial number of my device with C program, so the command to get the serial number is in shell:
dd if=/dev/mtd0 bs=1 skip=$((0x1fc30)) count=16 2>/dev/null
This will result something like this:
1866203214226041
Here's basically what I want to do:
#include <stdio.h>
#include <string.h>
int main ()
{
int sn;
sn=1866203214226041;
system("dd if=/dev/mtd0 bs=1 skip=$((0x1fc30)) count=16 2>/dev/null");
if (output of system == sn) {
printf("The serial number is verified\n");
}
else {
printf("The serial number is not verified\n");
}
return(0);
}
How can I do this ?