QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 1704|回复: 0
打印 上一主题 下一主题

函数大全(n ,o开头)

[复制链接]
字体大小: 正常 放大
韩冰        

823

主题

3

听众

4048

积分

我的地盘我做主

该用户从未签到

发帖功臣 元老勋章

跳转到指定楼层
1#
发表于 2004-10-4 02:56 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
< align=center><FONT color=#0000ff size=3><B><FONT color=#cc0000>函数大全(n ,o开头)</FONT></B></FONT></P>
. ~* R9 G/ L) J( M/ v6 V) ?6 ^! p<><FONT color=#ff0000>void normvideo(void );
2 e4 G, b6 ^9 C; ^) R</FONT>选择正常亮度字符。5 x# u# {) b0 f6 x8 g
将文本属性(前景和背景)置为启动程序时它所具有的值,来选择标准字符。</P>
5 H8 L/ L5 E/ F8 b- p! D' y0 X
! e( A* ], H6 o9 {2 |
: f+ t- l6 p2 P' P7 X' r" V<><FONT color=#ff0000>void nosound(void );
6 E# w& G6 u  M, N; `</FONT>关闭由调用 sound而发声的扬声器。% t% I7 a" V' D2 P# P7 D
</P>
: w4 H( [, a. c; L3 A0 c7 I/ N<><FONT color=#ff0000>函数名: open </FONT>* l6 ?8 {6 z0 ~/ v+ r
功 能: 打开一个文件用于读或写 9 d* O. k7 X7 K5 ~" U! M+ w$ [. ?
用 法: int open(char *pathname, int access[, int permiss]); - K/ G$ [  h- w
程序例: </P>
1 E" p" B' {; G0 H  P* \0 V<><FONT color=#0000ff>#include <STRING.H>' J+ |3 H7 A8 X" q) X" Y2 y
#include <STDIO.H>
& o4 d* ~  @  O#include <FCNTL.H>
8 ~9 l; N/ q# |" J# _, C#include <IO.H></FONT></P>: V- K9 C$ Z+ [7 b
<><FONT color=#0000ff>int main(void)
( V, z& e1 ]- {2 ^: S5 o{ - X2 j) s( A$ j& z; h' G
int handle;
' r5 q! ~$ h1 i( b' p' `; wchar msg[] = "Hello world"; </FONT></P>) t( r8 {7 z2 r8 K; J! s+ N
<><FONT color=#0000ff>if ((handle = open("TEST.$$$", O_CREAT | O_TEXT)) == -1)
2 D% f1 t7 g3 ^( i4 n) n{
9 ~% U/ B' \6 Eperror("Error:"); . ~( ]& C/ f# o/ e
return 1; / R( N: V4 M$ l% b2 f
} 4 {1 g* v  \8 r
write(handle, msg, strlen(msg));
1 M. j+ s; k; }0 ~4 oclose(handle);
% \) y$ A" o! n8 H  ^8 dreturn 0;
) I4 i* m, H8 g) v} 0 m. G4 E5 ]) d& `# N
</FONT># r/ C9 n' D  ?6 c0 O; C
</P>
$ a7 X2 T8 C% T' q5 y: s! Y0 f- x<><FONT color=#ff0000>函数名: outport </FONT>
9 \* r' ~6 j" R0 L2 W功 能: 输出整数到硬件端口中
6 P- s- Z; _/ _; d0 v4 O用 法: void outport(int port, int value); % @5 O' m. ]. Z! w
程序例: </P>
( l( ^( f$ Y( A$ h" u6 [5 D  E  B% ?<><FONT color=#0000ff>#include <STDIO.H>' \1 n( j, ], W8 k* a" A
#include <DOS.H>6 P% C9 x! j" @& o4 D( w; l
</FONT><FONT color=#0000ff>int main(void) / _8 M+ I2 a! K9 A$ ^
{
' W, T& W3 Q3 k$ c5 t! X% Y" qint value = 64;
6 W, P: m; A7 K0 e( W* iint port = 0; </FONT></P>
" \8 X2 T7 v; d: i<><FONT color=#0000ff>outportb(port, value); + j7 w! y; R# M
printf("Value %d sent to port number %d\n", value, port);
! J' g; X+ {+ \return 0; - }! z/ N8 w. k5 g
} 6 {3 y0 G. g  _% U! @, z, W8 U9 I
</FONT>
  J0 w1 g" L) A9 F* N1 J</P>
/ z, _8 Y: x% |1 i$ V<><FONT color=#ff0000>函数名: outportb </FONT>
2 D! S, H9 B2 s) }功 能: 输出字节到硬件端口中 , H# D- e/ J5 g3 }9 O! B
用 法: void outportb(int port, char byte); 2 ~% r4 N6 ^  w$ W9 U# J- J" p
程序例: </P>( g: t) w& m: n7 |9 z' c
<><FONT color=#0000ff>#include <STDIO.H>, L& }0 R9 S5 U& r5 M
#include <DOS.H></FONT></P>
3 `# N3 G9 a  z7 h$ V5 S<><FONT color=#0000ff>int main(void)
$ Y: `: V. A, y$ W" F4 V0 G2 W  [{ 0 `3 T' T3 y# q. y* C, o' W
int value = 64;
7 q6 w" z: ?8 Z0 ?5 r1 iint port = 0; </FONT></P>3 [* _7 X4 A7 U: g% H/ Q$ w
<><FONT color=#0000ff>outportb(port, value);
/ |1 Q8 q2 k: Y' zprintf("Value %d sent to port number %d\n", value, port);
6 q9 K; L1 {9 z9 Ureturn 0; : a5 c0 K  ^3 o4 Q3 X3 C& m& T
}
. D) s2 l8 h" x  m& V4 h</FONT>
% }# O0 y4 d1 X</P>
/ A0 V' V6 a7 p9 M  @<><FONT color=#ff0000>函数名: outtext </FONT>1 F8 g0 R9 y% {2 U
功 能: 在视区显示一个字符串
2 [" p7 Q" e; ]  w  o7 R3 K用 法: void far outtext(char far *textstring); ' u' \' J3 `3 s% J" E
程序例: </P>
* G# I7 L- @  l<><FONT color=#0000ff>#include <GRAPHICS.H>1 D8 b' w: F1 D: z+ t- Y" M4 O
#include <STDLIB.H>
5 c3 o; s# \% o# T#include <STDIO.H>
- N6 h4 x" Z( Z, `#include <CONIO.H></FONT></P>* l2 P/ |7 _2 W; }
<><FONT color=#0000ff>int main(void) * R+ L+ }) U+ H. Y" |& E
{ % o' c3 U: o# f$ a0 z' t1 A. _
/* request auto detection */
  O+ G' j" T" _2 _2 W3 q# ?int gdriver = DETECT, gmode, errorcode; 3 X! \; ^% G5 \5 J
int midx, midy; </FONT></P>/ z7 o/ L4 I4 g
<><FONT color=#0000ff>/* initialize graphics and local variables */
) j& H8 i0 X2 \9 N5 J, K5 [initgraph(&amp;gdriver, &amp;gmode, ""); </FONT></P>! t8 {8 t/ o: ~3 V. u; K* K3 c
<><FONT color=#0000ff>/* read result of initialization */
# S# d# X* w5 gerrorcode = graphresult(); 7 ^' ~; ~% e1 [! [$ o
if (errorcode != grOk) /* an error occurred */ : k/ d. G4 I& K( h1 u3 @
{   ]; E+ O1 {1 H
printf("Graphics error: %s\n", grapherrormsg(errorcode));
% e! d+ j" N  J( t6 u, r1 y3 e( Kprintf("ress any key to halt:"); 5 a) y0 T+ ^+ _$ ~$ h+ u" x  v
getch();
. F+ G1 u& A- o+ V8 s0 sexit(1); /* terminate with an error code */ ; |6 C. h7 F1 i! e. o
} </FONT></P>, z: o% C7 p% D( w; W9 y7 q9 G* l4 G' F, n: r
<><FONT color=#0000ff>midx = getmaxx() / 2; 4 i. u9 [5 [4 c$ [
midy = getmaxy() / 2; </FONT></P>
0 L/ V6 L( T7 L3 V<><FONT color=#0000ff>/* move the C.P. to the center of the screen */
8 E8 a$ u# f7 b6 m% g- Lmoveto(midx, midy); </FONT></P>
$ g+ Y. K  U( d% G: Q<><FONT color=#0000ff>/* output text starting at the C.P. */ ) G+ ~; n2 d3 q/ x8 T* p
outtext("This ");
3 E/ Y" v1 b3 k* W$ R: {1 mouttext("is ");
: v- m' E* D0 L# m9 J4 l, Youttext("a ");
4 d$ Q. ?. @; b/ v6 f( houttext("test."); </FONT></P>
& Y' i' j+ B" P% \' ^  C, Z<><FONT color=#0000ff>/* clean up */
& X6 u# E1 t; ]5 egetch(); * M$ K% x9 {4 K
closegraph(); ; z3 A. \* q( B, Q
return 0;
8 j, _( E9 c9 a) B2 M* L6 t! A6 L) v) e} </FONT>4 _$ N* s! B& f; ]; F3 F
) ]. u  s' [3 y& S
</P>! e0 o1 y9 e+ F
<><FONT color=#ff0000>函数名: outtextxy</FONT> ( s2 V# c  C/ u& C
功 能: 在指定位置显示一字符串
0 E- d6 q4 Z$ j* \用 法: void far outtextxy(int x, int y, char *textstring); $ _8 \$ \& @6 ?6 v/ ?
程序例: </P>* Q: D' ]8 `; e$ v5 v) V8 d
<><FONT color=#0000ff>#include <GRAPHICS.H>
% q6 V* r, D( b5 z1 C+ Z1 _, z#include <STDLIB.H>5 i' ^# ~! _2 o3 ~; s& I5 p( v
#include <STDIO.H># W/ E* T5 s- {/ l* P
#include <CONIO.H></FONT></P>9 [* J  y9 A( i0 S0 X1 t
<><FONT color=#0000ff>int main(void) 3 p$ k+ Y9 n6 [
{ 0 S% @" g  l5 F: x+ v% ~' g9 P9 d
/* request auto detection */
6 Z! x- a; m! }1 R/ vint gdriver = DETECT, gmode, errorcode; ! ?; E3 P$ N9 O$ S/ q
int midx, midy; </FONT></P>( P3 B4 j0 ~4 I! n) J
<><FONT color=#0000ff>/* initialize graphics and local variables */
' l& M- F  [' M2 _! }0 linitgraph( &amp;gdriver, &amp;gmode, ""); </FONT></P>  J6 Y9 }, Z/ z
<><FONT color=#0000ff>/* read result of initialization */ 2 w# l2 ?/ `6 F7 D) k4 L
errorcode = graphresult();
& ~1 i  v& F% e$ ^% r, i1 wif (errorcode != grOk) /* an error occurred */
6 g2 u0 N6 {- T; ]$ X$ i/ a{
, a4 f% `- r$ @1 w% B+ I1 ~printf("Graphics error: %s\n", grapherrormsg(errorcode)); 2 M* l6 ^5 C/ d/ G. W+ {( X
printf("ress any key to halt:"); - H, h- _% U; `
getch();
2 E4 Y( U' P: ?" O) J% B' b* pexit(1); /* terminate with an error code */ 2 b7 E  q2 U4 [! a! |
} </FONT></P>7 }1 Q- p5 }' U) M
<P><FONT color=#0000ff>midx = getmaxx() / 2; 6 W5 Q& u: b% y/ Z9 y
midy = getmaxy() / 2; </FONT></P>$ X. m& R) a% N1 z* x' `7 E4 K. w
<P><FONT color=#0000ff>/* output text at the center of the screen*/ - j, k5 j9 V: L0 b
/* Note: the C.P. doesn't get changed.*/
% \$ \3 C# v- ?9 u) p$ Mouttextxy(midx, midy, "This is a test."); </FONT></P>+ _1 M" }1 O5 Y% _& _& }, u; j
<P><FONT color=#0000ff>/* clean up */ % y  Y9 O) r/ I1 a) o! a
getch();
; E3 O$ M: M& p0 tclosegraph();
7 d' W  j% O: A7 h# q- V* dreturn 0; 3 q# B" H) l9 f  ?4 t; h# v
} </FONT></P>
zan
转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
您需要登录后才可以回帖 登录 | 注册地址

qq
收缩
  • 电话咨询

  • 04714969085
fastpost

关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

手机版|Archiver| |繁體中文 手机客户端  

蒙公网安备 15010502000194号

Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

GMT+8, 2026-4-20 06:14 , Processed in 0.293004 second(s), 52 queries .

回顶部