- 最後登錄
- 2022-5-29
- 在線時間
- 1 小時
- 註冊時間
- 2017-6-8
- 閱讀權限
- 20
- 精華
- 0
- UID
- 9020912
- 帖子
- 176
- 積分
- 291 點
- 潛水值
- 2840 米
| 如果你忘記伊莉的密碼,請在登入時按右邊出現的 '找回密碼'。輸入相關資料後送出,系統就會把密碼寄到你的E-Mail。 本帖最後由 MY0613 於 2011-7-18 09:19 PM 編輯
- #include <bios.h>
- #include <stdio.h>
- main()
- {
- struct diskinfo_t di;
- int result;
- static char dbuf[512];
-
- di.drive=0;
- di.head=0;
- di.track=0;
- di.sector=1;
- di.nsectors=1;
- di.buffer=dbuf;
- print f("Attempting to read from drive A:\n");
- result=_bios_disk(_DISK_READ,&di);
- if ((result & 0xf00)==0)
- {
- print f("Disk read from A: successful!\n");
- print f("Fist three bytes read are 0x%02X 0x%02X 0x%02x\n",dbuf[0] & 0xff,dbuf[1],dbuf[2] & 0xff);
- }
- else
- print f("Can't read drive A,status = 0x%02x\n",result);
-
- system("pause");
- return 0;
- }
複製代碼 小弟不才,應該是 <bios.h> 在dev-C++ 中不支援。
但還沒去查可使用哪個function 去取代 _bios_disk
後記:
這程式看來很古老了,是給MSDOS使用的,_bios_disk()透過 BIOS 中的INT.13h 來控制磁碟機的硬體動作。
在Winodw的系統中,已無法從上層(Application) 直接存取HW的動作,
必需透過 Windows DDK 來寫 kernel 中的 driver 達成這個動作。
目前看起來我只能幫到這了…應該不太像是 BC++ 與 Dev-C++ 的相容問題。...
|
|