C语言函数集(二十一)
函数名: wherex
功 能: 返回窗口内水平光标位置
用 法: int wherex(void);
程序例:
#include <conio.h>
int main(void)
{
clrscr();
gotoxy(10,10);
cprintf("Current location is X: %d Y: %d\r\n", wherex(), wherey());
getch();
return 0;
}
函数名: wherey
功 能: 返回窗口内垂直光标位置
用 法: int wherey(void);
程序例:
#include <conio.h>
int main(void)
{
clrscr();
gotoxy(10,10);
cprintf("Current location is X: %d Y: %d\r\n", wherex(), wherey());
getch();
return 0;
}
函数名: window
功 能: 定义活动文本模式窗口
用 法: void window(int left, int top, int right, int bottom);
程序例:
#include <conio.h>
int main(void)
{
window(10,10,40,11);
textcolor(BLACK);
textbackground(WHITE);
cprintf("This is a test\r\n");
return 0;
}
函数名: write
功 能: 写到一文件中
用 法: int write(int handel, void *buf, int nbyte);
程序例:
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys\stat.h>
#include <io.h>
#include <string.h>
int main(void)
{
int handle;
char string[40];
int length, res;
/*
Create a file named "TEST.$$$" in the current directory and write
a string to it. If "TEST.$$$" already exists, it will be overwritten.
*/
if ((handle = open("TEST.$$$", O_WRONLY | O_CREAT | O_TRUNC,
S_IREAD | S_IWRITE)) == -1)
{
printf("Error opening file.\n");
exit(1);
}
strcpy(string, "Hello, world!\n");
length = strlen(string);
if ((res = write(handle, string, length)) != length)
{
printf("Error writing to the file.\n");
exit(1);
}
printf("Wrote %d bytes to the file.\n", res);
close(handle);
return 0;
}
C语言函数集(二十一)相关推荐
- C语言函数集(十一)
函数名: labs 功 能: 取长整型绝对值 用 法: long labs(long n); 程序例: #include <stdio.h> #include <math.h> ...
- c语言字符二维数组传参,C语言函数传递二维数组
C语言如果给函数传递二维数组作为参数 问题的产生 先看一个传递二维数组的例子: #include void foo(int a[][], int m, int n) { int i = 1; int ...
- 【C语言】案例二十一 从键盘输入一组数据,求出这一组数据的平均值并输出(调用函数)
函数的定义 在C语言中最基础的程序模块就是函数,函数被视为程序中的基本逻辑单位,一个C语言程序由一个main()函数和若干个普通函数构成. 定义一个C函数的语法格式如下: 返回值类型 函数名([[参数 ...
- C语言函数集(二十)
函数名: vfprintf 功 能: 送格式化输出到一流中 用 法: int vfprintf(FILE *stream, char *format, va_list param); 程序例: #in ...
- C语言函数集(十二)
main()主函数 每一C 程序都必须有一main()函数, 可以根据自己的爱好把它放在程序的某个地方.有些程序员把它放在最前面, 而另一些程序员把它放在最后面, 无论放在哪个地方, 以下几点说明都是 ...
- 使用c语言函数使二数相减,什么是c语言
手机评站网今天精心准备的是<什么是c语言>,下面是详解! 什么是C语言和C+语言 1.C语言. C语言诞生得非常早,当时人们普遍还习惯用汇编语言编写软件,并且没有什么统一,通用的操作系统, ...
- 2021年大数据常用语言Scala(二十一):函数式编程 遍历 foreach
目录 遍历 foreach 使用类型推断简化函数定义 使用下划线来简化函数定义 遍历 foreach 之前,学习过了使用for表达式来遍历集合.我们接下来将学习scala的函数式编程,使用fore ...
- C语言函数集(十八)
函数名: tan 功 能: 正切函数 用 法: double tan(double x); 程序例: #include <stdio.h> #include <math.h> ...
- C语言函数集(十七)
函数名: sbrk 功 能: 改变数据段空间位置 用 法: char *sbrk(int incr); 程序例: #include <stdio.h> #include <alloc ...
最新文章
- Android 按压效果的工具类
- RedHat 7.0 Chrome浏览器 安装
- python把nan值去掉_python – Keras Neural Nets,如何删除输出中的NaN值?
- 戴尔怎样把计算机放在桌面,戴尔台式机桌面图标不见了怎么办
- 提高团队整体能力-同一片天“技术交流会”
- linux kernel中的virt_to_phys代码解读
- ieee很多个作者都在一排上面的官方模版(作者栏简介大气)
- div置于页面底部_网易内部PPT模板有点丑,如何花最少的时间提高页面颜值?
- Kaggle API
- 阿里云服务器mysql莫名丢失_mysql数据库丢失
- Oracle 19c 新特性:ADG的自动DML重定向增强读写分离
- 常见的反爬措施:UA反爬和Cookie反爬
- html计算天数,Javascript实现简易天数计算器
- Apollo 在Windows下安装使用
- 湖南工程学院计算机网期末考试,湖南工程学院__操作系统期末试卷试题
- 51单片机的矩阵键盘、跑马灯和呼吸灯设计
- 华为 U2000 网管系统 批量添加全网OLT设备TELNET账号
- 网吧web电影服务器系统,网吧电影服务器如何安装制作?
- win10 u盘 修复计算机,u盘启动修复Win10引导文件丢失的方法
- 假期北京旅游请注意了!