📄 tchkf.doc
字号:
TCHK 2.1 Page 9
Function ansi_call - create an ANSI escape sequence
Syntax char *ansi_call(int subfunction, int parm1, int
parm2, char *ansistring);
Prototype in ansihk.h
Remarks ansi_call is a general function that will create an
ANSI escape sequence for the given subfunction:
1: gotoxy(parm1,parm2)
2: cursor_right
3: cursor_left
4: cursor_up
5: cursor_down
6: save_cursor_position
7: restore_cursor_position
8: cls()
9: clear_eol()
10: set_foreground(parm1)
11: set_background(parm1)
12: clear_attributes (plain, normal)
13: bold
14: faint
15: italic
16: blink
17: fast_blink
18: inverse
19: invisible
20: set_mode(parm1)
21: reset_mode(parm1)
22: wherexy()
1: moves cursor to (parm1,parm2)
2-5: move cursor 1 space in direction indicated
6-7: save cursor position for future restoring
8: clear screen
9: clear to the end of current line
10-11: set colors for output
12-15,18-19: set attributes for output
16-17: control cursor blink rate
20-21: change mode (not same as DOS, see ansihk.h)
22: outputs the current cursor location
A value must be passed for parm1 and parm2, even if
they are not going to be used.
The escape sequence ansistring can be outputted
with a simple printf().
Remember, ANSI.SYS, FANSI-CONSOLE, or some similar
ANSI control sequence program must be active for
these codes to take effect.
TCHK 2.1 Page 10
Return value returns ansistring.
Note The color codes needed by ANSI functions are NOT
the same as the color codes used by DOS to set
attributes. Use the ANSI color #defines given in
ansihk.h.
See also ansiback(), ansifore()
TCHK 2.1 Page 11
Function ansiback - convert DOS background code to ANSI
Syntax int ansiback(char code);
Prototype in ansihk.h
Remarks DOS and ANSI use different values for colors. This
function converts a DOS background color code to
the ANSI color code for the same color.
Return value returns the ANSI background color code
See also ansi_call(), ansifore()
TCHK 2.1 Page 12
Function ansifore - convert DOS foreground code to ANSI
Syntax int ansifore(char code);
Prototype in ansihk.h
Remarks DOS and ANSI use different values for colors. This
function converts a DOS foreground color code to
the ANSI color code for the same color.
Return value returns the ANSI foreground color code
See also ansi_call(), ansiback()
TCHK 2.1 Page 13
Function atrim - trims leading and trailing blanks
Syntax char *atrim(char *source);
Prototype in stringhk.h
Remarks remove leading and trailing blanks in a string. The
string passed to atrim (source) is modified.
Return value returns a pointer to source.
Example #include <stringhk.h>
#include <stdio.h> /* for the printf */
main()
{
char msg[25] = " Hello everyone ";
printf("String [%s]\n",msg);
printf("atrim [%s]\n",atrim(msg));
}
Program output String [ Hello everyone ]
atrim [Hello everyone]
TCHK 2.1 Page 14
Function average - calculate the average of a set of reals
Syntax double average(int n, double element[]);
Prototype in mathhk.h
Remarks average calculates the average of a set of n
numbers of type double.
Return value returns the average of a set of n numbers.
See also stddev(), summation(), variance()
Example #include <mathhk.h>
main()
{
double num[] = { 2.3, 7.1, 6.05 };
printf("Average is %lf\n",average(3,num));
}
Program output Average is 5.15
TCHK 2.1 Page 15
Function beep - generate a standard IBM PC beep
Syntax void beep(void);
Prototype in sound.h
Remarks makes the speaker beep (just like the beep during
bootup).
See also Tone()
Return value nothing.
TCHK 2.1 Page 16
Function bitrevb - bit reverse a byte
Syntax unsigned char bitrevb(unsigned char value);
Prototype in mathhk.h
Remarks bitrevb() will reverse the bits in the byte value.
Return value returns the reversed byte.
See also bitrevl(), bitrevw()
Example #include <mathhk.h>
main()
{
printf("0x01 reversed => 0x%02X\n",
bitrevb(0x01));
}
Program output 0x01 reversed => 0x80
TCHK 2.1 Page 17
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -