国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

C語言庫函數(W類字母)

2019-11-17 05:42:54
字體:
來源:轉載
供稿:網友
     
函數名: wherex
功  能: 返回窗口內水平光標位置
用  法: int wherex(void);
程序例: 

#include <conio.h> 

int main(void)
{
   clrscr();
   gotoxy(10,10);
   c   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;
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鹤庆县| 桑日县| 湘潭市| 侯马市| 同德县| 漠河县| 渝北区| 敦化市| 南充市| 海淀区| 宜都市| 鹿泉市| 沁源县| 双江| 临湘市| 珠海市| 临洮县| 青川县| 凌源市| 桂林市| 肥西县| 堆龙德庆县| 乡城县| 尚义县| 三明市| 石首市| 万盛区| 扎囊县| 佛坪县| 石景山区| 绥芬河市| 九寨沟县| 枣庄市| 铜山县| 凭祥市| 黄浦区| 永嘉县| 石楼县| 子洲县| 沙洋县| 四川省|