⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fw.htm

📁 C语言编程宝典.rar,学习C语言的经典初级教程
💻 HTM
字号:
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
   <META NAME="Author" CONTENT="wdg">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (Win95; I) [Netscape]">
   <TITLE>fw</TITLE>
</HEAD>
<BODY>
&nbsp;
<BR>&nbsp;
<BR>&nbsp;

<P>函数名: wherex
<BR>功&nbsp; 能: 返回窗口内水平光标位置
<BR>用&nbsp; 法: int wherex(void);
<BR>程序例:

<P>#include &lt;conio.h>

<P>int main(void)
<BR>{
<BR>&nbsp;&nbsp; clrscr();
<BR>&nbsp;&nbsp; gotoxy(10,10);
<BR>&nbsp;&nbsp; cprintf("Current location is X: %d&nbsp; Y: %d\r\n", wherex(),
wherey());
<BR>&nbsp;&nbsp; getch();

<P>&nbsp;&nbsp; return 0;
<BR>}
<BR>&nbsp;
<BR>&nbsp;
<BR>&nbsp;

<P>函数名: wherey
<BR>功&nbsp; 能: 返回窗口内垂直光标位置
<BR>用&nbsp; 法: int wherey(void);
<BR>程序例:

<P>#include &lt;conio.h>

<P>int main(void)
<BR>{
<BR>&nbsp;&nbsp; clrscr();
<BR>&nbsp;&nbsp; gotoxy(10,10);
<BR>&nbsp;&nbsp; cprintf("Current location is X: %d&nbsp; Y: %d\r\n", wherex(),
wherey());
<BR>&nbsp;&nbsp; getch();

<P>&nbsp;&nbsp; return 0;
<BR>}
<BR>&nbsp;
<BR>&nbsp;
<BR>&nbsp;

<P>函数名: window
<BR>功&nbsp; 能: 定义活动文本模式窗口
<BR>用&nbsp; 法: void window(int left, int top, int right, int bottom);
<BR>程序例:

<P>#include &lt;conio.h>

<P>int main(void)
<BR>{

<P>&nbsp;&nbsp; window(10,10,40,11);
<BR>&nbsp;&nbsp; textcolor(BLACK);
<BR>&nbsp;&nbsp; textbackground(WHITE);
<BR>&nbsp;&nbsp; cprintf("This is a test\r\n");

<P>&nbsp;&nbsp; return 0;
<BR>}
<BR>&nbsp;
<BR>&nbsp;
<BR>&nbsp;

<P>函数名: write
<BR>功&nbsp; 能: 写到一文件中
<BR>用&nbsp; 法: int write(int handel, void *buf, int nbyte);
<BR>程序例:

<P>#include &lt;stdio.h>
<BR>#include &lt;stdlib.h>
<BR>#include &lt;fcntl.h>
<BR>#include &lt;sys\stat.h>
<BR>#include &lt;io.h>
<BR>#include &lt;string.h>

<P>int main(void)
<BR>{
<BR>&nbsp;&nbsp; int handle;
<BR>&nbsp;&nbsp; char string[40];
<BR>&nbsp;&nbsp; int length, res;

<P>&nbsp;&nbsp; /*
<BR>&nbsp;&nbsp;&nbsp; Create a file named "TEST.$$$" in the current directory
and write
<BR>&nbsp;&nbsp;&nbsp; a string to it.&nbsp; If "TEST.$$$" already exists,
it will be overwritten.
<BR>&nbsp;&nbsp; */

<P>&nbsp;&nbsp; if ((handle = open("TEST.$$$", O_WRONLY | O_CREAT | O_TRUNC,
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
S_IREAD | S_IWRITE)) == -1)
<BR>&nbsp;&nbsp; {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Error opening file.\n");
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(1);
<BR>&nbsp;&nbsp; }

<P>&nbsp;&nbsp; strcpy(string, "Hello, world!\n");
<BR>&nbsp;&nbsp; length = strlen(string);

<P>&nbsp;&nbsp; if ((res = write(handle, string, length)) != length)
<BR>&nbsp;&nbsp; {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Error writing to the file.\n");
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(1);
<BR>&nbsp;&nbsp; }
<BR>&nbsp;&nbsp; printf("Wrote %d bytes to the file.\n", res);

<P>&nbsp;&nbsp; close(handle);
<BR>&nbsp;&nbsp; return 0;
<BR>}
<BR>&nbsp;

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="index.html">返回目录</A>

<BR>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -