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

字號(hào):

函數(shù)名: 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;
    }
    函數(shù)名: peek
    功 能: 檢查存儲(chǔ)單元
    用 法: 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;
    }
    函數(shù)名: peekb
    功 能: 檢查存儲(chǔ)單元
    用 法: char peekb (int segment, unsigned offset);
    程序例:
    #include
    #include
    #include
    int main(void)
    {
    int value = 0;
    printf("The current status of your keyboard is:\n");
    value = peekb(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;
    }