Get a physical hard disk serial number under Linux

xiaoxiao2021-03-06  61

Get a physical hard disk serial number under Linux

No .: QA004753 Date: November 8, 2003 Date: November 8, 2003 Category:

C / C - Disk, files and directories

Q Anonymous: REDHAT 7.2 Linux kernel 2.4.18 Programming Tool: GCC Problem: I hope to get the following code (not a logical disk) at the Redhat 7.2 Linux core 2.4.18 attempt (compiled with GCC) ), However, when running, ending: "segment fault" requests you, thank you very much! / / =========================================================================================================================================================================================== ======== #include #include #include #include #define extern #include char * GetASCII (unsigned int in_data [], int off_start, int off_end); static int waiting () {int al; while ((al = INB (0x1f7))> = 0x80); return al;} static void readide ()}} static void readide ()} Al; INT i; Word Pw [256]; Waitide (); OUTB (0xA0, 0x1f6); Al = Waitide (); if ((AL & 0x50)! = 0x50) Return; OUTB (0xA0, 0x1f6); OUTB (0xec, 0x1f7); Al = Waitide (); IF ((al & 0x58)! = 0x58) Return; for (i = 0; i <256; i ) {PW [i] = INW (0x1f0);}} int main (void) {Readide ();} // ========================================== ==============

A Answer: Add IOPERM (0x1f0, 16, 1) at the beginning of Readide;

This issue is replied by CNGB.

Additional Keywords: Programming, Source Program, Programming, Source Code, C / C , MFC, C Builder, Borland C , Turbo C, C, BCB, Disk, File, Directory, DISK, File, Fat, Directory, Folder.

转载请注明原文地址:https://www.9cbs.com/read-112559.html

New Post(0)