c语音函数大全(W开头)

c语音函数大全(W开头)

There is no nutrition in the blog content. After reading it, you will not only suffer from malnutrition, but also impotence.
The blog content is all parallel goods. Those who are worried about being cheated should leave quickly.

函数名: 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;
}

相关推荐

  1. c语音函数大全(W开头)

    2024-03-30 12:00:03       43 阅读
  2. c语音函数大全(S开头)

    2024-03-30 12:00:03       35 阅读
  3. c语音函数大全(U开头)

    2024-03-30 12:00:03       38 阅读
  4. c语音函数大全(V开头)

    2024-03-30 12:00:03       34 阅读
  5. c语言函数大全(C开头)

    2024-03-30 12:00:03       31 阅读
  6. c语言函数大全(O开头)

    2024-03-30 12:00:03       36 阅读
  7. c语言函数大全(D开头)

    2024-03-30 12:00:03       34 阅读
  8. c语言函数大全(I开头)

    2024-03-30 12:00:03       31 阅读
  9. C语言获取时间函数大全

    2024-03-30 12:00:03       49 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-30 12:00:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-30 12:00:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-30 12:00:03       82 阅读
  4. Python语言-面向对象

    2024-03-30 12:00:03       91 阅读

热门阅读

  1. ORACLE 存中文

    2024-03-30 12:00:03       35 阅读
  2. LeetCode 345. 反转字符串中的元音字母

    2024-03-30 12:00:03       39 阅读
  3. CentOS 7.9上创建Redis用户和组

    2024-03-30 12:00:03       41 阅读
  4. MySQL的索引

    2024-03-30 12:00:03       32 阅读
  5. Redis中Hash数据结构的底层实现

    2024-03-30 12:00:03       45 阅读
  6. RISC-V单板计算机模拟和FPGA板多核IP实现

    2024-03-30 12:00:03       41 阅读
  7. axios详解

    2024-03-30 12:00:03       31 阅读
  8. 在银河麒麟系统中安装nginx

    2024-03-30 12:00:03       146 阅读