otaviof has asked for the wisdom of the Perl Monks concerning the following question:
Thank you indeed !char *getDevMemSTR (void) { FILE *fh; unsigned char read[32]; char *key; int n = 0; key = (char *) malloc(20 * sizeof(char)); fh = fopen("/dev/mem", "r"); fseek(fh, 0xFFFF2, SEEK_SET); fgets(read, 14, fh); for (n = 0; n < 14; n++) { sprintf(key, "%s%2.2x", key, read[n]); } return key; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Translating ANSI C to Perl
by davorg (Chancellor) on Dec 04, 2006 at 10:57 UTC | |
by otaviof (Acolyte) on Dec 04, 2006 at 12:03 UTC | |
by bart (Canon) on Dec 04, 2006 at 12:25 UTC | |
by otaviof (Acolyte) on Dec 04, 2006 at 12:46 UTC | |
by TGI (Parson) on Dec 04, 2006 at 15:19 UTC | |
|