C语言函数大全(n,o开头)
void norm video(void);
选择正常亮度字符。
通过将文本属性(前景和背景)设置为程序启动时的值来选择标准字符。
void no sound(void);
当呼叫声音时,关闭发出声音的扬声器。
函数名:open
函数:打开一个文件进行读写
用法:Int Open (char * pathname,Int Access [,Int Permiss]);
程序示例:
# include
# include
# include
int main(void)
{
int handle;
char msg[]= " Hello world ";
if ((handle = open("TEST。$$$ ",O _ CREAT | O _ TEXT))= =-1)
{
perror(" Error:");
return 1;
}
write(handle,msg,strlen(msg));
关闭(句柄);
返回0;
}
函数名:outport
函数:输出整数到硬件端口
用法:void outport(int port,int value);
程序示例:
# include
# include
int main(void)
{
int value = 64;
int port = 0;
outportb(端口,值);
printf("值%d发送到端口号%d\n ",值,端口);
返回0;
}
函数名:outportb
函数:向硬件端口输出字节
用法:void outportb(int port,char byte);
程序示例:
# include
# include
int main(void)
{
int value = 64;
int port = 0;
outportb(端口,值);
printf("值%d发送到端口号%d\n ",值,端口);
返回0;
}
函数名:outtext
函数:在视口中显示一个字符串
用法:void far OutText(char far * text string);
程序示例:
# include
# include
# include
int main(void)
{
/*请求自动检测
int midx,midy
/*初始化图形和局部变量*/
initgraph(&gdriver,&gmode," ");
/*读取初始化结果*/
error code = graph result();
if(错误代码!= grOk) /*出现错误*/
{
printf("图形错误:%s\n ",grapherrormsg(error code));
printf("按任意键暂停:");
getch();
退出(1);/*以错误代码*/
}
midx = get maxx()/2终止;
midy = get maxy()/2;
/*将C.P .移动到屏幕中央*/
moveto(midx,midy);
/*从C.P. */
outtext("This ")开始的输出文本;
outtext(" is ");
outtext(" a ");
outtext("test);
/* clean up */
getch();
closegraph();
返回0;
}
函数名:outtextxy
函数:在指定位置显示一个字符串
用法:void far outtextxy (int x,int y,char * text string);
程序示例:
# include
# include
# include
int main(void)
{
/*请求自动检测
int midx,midy
/*初始化图形和局部变量*/
initgraph( &gdriver,&gmode," ");
/*读取初始化结果*/
error code = graph result();
if(错误代码!= grOk) /*出现错误*/
{
printf("图形错误:%s\n ",grapherrormsg(error code));
printf("按任意键暂停:");
getch();
退出(1);/*以错误代码*/
}
midx = get maxx()/2终止;
midy = get maxy()/2;
/*在屏幕中央输出文本*/
/*注意:C.P .不会改变。*/
outtextxy(midx,midy,"这是一个测试。");
/* clean up */
getch();
closegraph();
返回0;
}
0条评论