C語言函數大全(p開頭)

函數名: parsfnm
功能: 分析文件名
用法: char *parsfnm (char *cmdline, struct fcb *fcbptr, int option);
程序例:
#include
#include
#include
#include
int main(void)
{
char line[80];
struct fcb blk;
/* get file name */
printf("Enter drive and file name (no path - ie. a:file.dat)\n");
gets(line);
/* put file name in fcb */
if (parsfnm(line, &blk, 1) == NULL)
printf("Error in parsfm call\n");
else
printf("Drive #%d Name: %11s\n", blk.fcb_drive, blk.fcb_name);
return 0;
}
函數名: peek
功能: 檢查存儲單元
用法: int peek(int segment, unsigned offset);
程序例:
#include
#include
#include
int main(void)
{
int value = 0;
printf("The current status of your keyboard is:\n");
value = peek(0x0040, 0x0017);
if (value & 1)
printf("Right shift on\n");
else
printf("Right shift off\n");
if (value & 2)
printf("Left shift on\n");
else
printf("Left shift off\n");
if (value & 4)
printf("Control key on\n");
else
printf("Control key off\n");
if (value & 8)
printf("Alt key on\n");
else
printf("Alt key off\n");
if (value & 16)
printf("Scroll lock on\n");
else
printf("Scroll lock off\n");
if (value & 32)
printf("Num lock on\n");
else
printf("Num lock off\n");
if (value & 64)
printf("Caps lock on\n");
else
printf("Caps lock off\n");
return 0;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章