c语言函数--O
来源:互联网 发布:淘宝fgo充值便宜 编辑:程序博客网 时间:2024/05/21 07:00
最全古典小说网 由本软件发布所得
函数名: open
功 能: 打开一个文件用于读或写
用 法: int open(char *pathname, int access[, int permiss]);
程序例:
#include <string.h> #include <stdio.h> #include <fcntl.h> #include <io.h> 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)); close(handle); return 0; }
函数名: outport
功 能: 输出整数到硬件端口中
用 法: void outport(int port, int value);
程序例:
#include <stdio.h> #include <dos.h> int main(void) { int value = 64; int port = 0; outportb(port, value); printf("Value %d sent to port number %d\n", value, port); return 0; }
函数名: outportb
功 能: 输出字节到硬件端口中
用 法: void outportb(int port, char byte);
程序例:
#include <stdio.h> #include <dos.h> int main(void) { int value = 64; int port = 0; outportb(port, value); printf("Value %d sent to port number %d\n", value, port); return 0; }
函数名: outtext
功 能: 在视区显示一个字符串
用 法: void far outtext(char far *textstring);
程序例:
#include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int midx, midy; /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } midx = getmaxx() / 2; midy = getmaxy() / 2; /* move the C.P. to the center of the screen */ moveto(midx, midy); /* output text starting at the C.P. */ outtext("This "); outtext("is "); outtext("a "); outtext("test."); /* clean up */ getch(); closegraph(); return 0; }
函数名: outtextxy
功 能: 在指定位置显示一字符串
用 法: void far outtextxy(int x, int y, char *textstring);
程序例:
#include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int midx, midy; /* initialize graphics and local variables */ initgraph( &gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } midx = getmaxx() / 2; midy = getmaxy() / 2; /* output text at the center of the screen*/ /* Note: the C.P. doesn't get changed.*/ outtextxy(midx, midy, "This is a test."); /* clean up */ getch(); closegraph(); return 0; }
书画小说软件 制作更惬意的读、更舒心的写、更轻松的发布
最全古典小说网 由本软件发布所得
0 0
- c语言函数--O
- C语言函数O字母
- 理解C语言标准I/O函数
- C 语言标准 I/O 函数介绍以及演示程序
- C语言学习笔记系列(4)I/O函数
- C语言标准I/O函数及其特点总结
- C语言linux I/O函数集与windows I/O 函数集
- linux I/O函数集及windows C语言I/O函数集
- C语言linux I/O函数集与windows I/O 函数集
- C语言标准I/O
- C语言学习笔记之格式化I/O(scanf函数、printf函数)
- C语言学习笔记之字符I/O(getchar()函数与putchar()函数)
- C语言学习笔记之字符串I/O(gets()函数和puts()函数)
- C语言学习笔记之文件I/O(fgets()函数和fputs()函数)
- 深入理解C语言----标准I/O小结(缓冲区,I/O函数及其他相关问题)
- 【C语言】C语言函数
- C语言函数 --C
- c函数之【初级I/O函数】
- 【无限互联】学员作品:IT之家IOS客户端
- 开放的平台、向上的文化——揭秘万达电商(4)
- 交作业 php100 第五讲 九九乘法表
- 仿小说阅读器
- 移动营销哪家强?微库为上万家品牌服务的营销启示
- c语言函数--O
- 黑马程序员-----Java基础IO流综合实例
- 【安卓】现在安卓手机主流的分辨率是多少呢?
- 求n个骰子的点数
- c++的内存分配(转载)
- 【无限互联】学员作品:糗事百科IOS客户端
- 计算单词出现的频率
- Java语言基础组成
- 2014.10.19学习总结(服务)