📄 王大刚--c语言编程宝典--w.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0038)http://www.hjflying.8u8.com/cl/040.htm -->
<HTML><HEAD><TITLE>王大刚-->C语言编程宝典-->W</TITLE>
<META http-equiv=Content-Type content="text/html; charset=GB2312">
<META content="王大刚 C语言编程宝典 W" name=keywords>
<META content="王大刚 - C语言编程宝典 - W" name=description>
<STYLE>#page {
LEFT: 0px; POSITION: absolute; TOP: 0px
}
.tt3 {
FONT: 9pt/12pt "宋体"
}
.tt2 {
FONT: 12pt/15pt "宋体"
}
A {
TEXT-DECORATION: none
}
A:hover {
COLOR: blue; TEXT-DECORATION: underline
}
</STYLE>
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY text=#000000 vLink=#006699 aLink=#9900ff link=#006699 bgColor=#ffffff
leftMargin=3 topMargin=3 marginwidth="3" marginheight="3">
<TABLE cellSpacing=0 cellPadding=10 width="100%" border=0>
<TBODY>
<TR>
<TD class=tt3 vAlign=top width="8%" bgColor=#e0e0e0><STRONG><A
href="http://www.hjflying.8u8.com/cl/041.htm">后一页</A><BR><A
href="http://www.hjflying.8u8.com/cl/039.htm">前一页</A><BR><A
href="http://www.hjflying.8u8.com/cl/index.html">回目录</A><BR><A
href="http://www.hjflying.8u8.com/index.htm">回首页</A><BR></STRONG></TD>
<TD class=tt2 width="84%" bgColor=#f5f8f8>
<CENTER><B><FONT style="FONT-SIZE: 16.5pt" face=楷体_GB2312
color=#ff6666>W</FONT></B></CENTER>
<HR width="94%" color=#ee9b73 SIZE=1>
<P>函数名: wherex <BR>功 能: 返回窗口内水平光标位置 <BR>用 法: int wherex(void);
<BR>程序例: <BR>
<P>#include <conio.h> <BR>
<P>int main(void) <BR>{ <BR> clrscr(); <BR>
gotoxy(10,10); <BR> cprintf("Current location is X: %d
Y: %d\r\n", wherex(), wherey()); <BR> getch(); <BR>
<P> return 0; <BR>} <BR> <BR> <BR> <BR>
<P>函数名: wherey <BR>功 能: 返回窗口内垂直光标位置 <BR>用 法: int wherey(void);
<BR>程序例: <BR>
<P>#include <conio.h> <BR>
<P>int main(void) <BR>{ <BR> clrscr(); <BR>
gotoxy(10,10); <BR> cprintf("Current location is X: %d
Y: %d\r\n", wherex(), wherey()); <BR> getch(); <BR>
<P> return 0; <BR>} <BR> <BR> <BR> <BR>
<P>函数名: window <BR>功 能: 定义活动文本模式窗口 <BR>用 法: void window(int
left, int top, int right, int bottom); <BR>程序例: <BR>
<P>#include <conio.h> <BR>
<P>int main(void) <BR>{ <BR>
<P> window(10,10,40,11); <BR> textcolor(BLACK);
<BR> textbackground(WHITE); <BR> cprintf("This is
a test\r\n"); <BR>
<P> return 0; <BR>} <BR> <BR> <BR> <BR>
<P>函数名: write <BR>功 能: 写到一文件中 <BR>用 法: int write(int handel,
void *buf, int nbyte); <BR>程序例: <BR>
<P>#include <stdio.h> <BR>#include <stdlib.h> <BR>#include
<fcntl.h> <BR>#include <sys\stat.h> <BR>#include <io.h>
<BR>#include <string.h> <BR>
<P>int main(void) <BR>{ <BR> int handle; <BR> char
string[40]; <BR> int length, res; <BR>
<P> /* <BR> Create a file named "TEST.$$$"
in the current directory and write <BR> a string to
it. If "TEST.$$$" already exists, it will be overwritten.
<BR> */ <BR>
<P> if ((handle = open("TEST.$$$", O_WRONLY | O_CREAT |
O_TRUNC,
<BR>
S_IREAD | S_IWRITE)) == -1) <BR> {
<BR> printf("Error opening file.\n");
<BR> exit(1); <BR> } <BR>
<P> strcpy(string, "Hello, world!\n"); <BR> length
= strlen(string); <BR>
<P> if ((res = write(handle, string, length)) != length)
<BR> { <BR> printf("Error
writing to the file.\n"); <BR> exit(1);
<BR> } <BR> printf("Wrote %d bytes to the
file.\n", res); <BR>
<P> close(handle); <BR> return 0; <BR>} <BR>
<BR>
<HR width="94%" color=#ee9b73 SIZE=1>
</TD>
<TD class=tt3 vAlign=bottom width="8%" bgColor=#e0e0e0><STRONG><A
href="http://www.hjflying.8u8.com/cl/041.htm">后一页</A><BR><A
href="http://www.hjflying.8u8.com/cl/039.htm">前一页</A><BR><A
href="http://www.hjflying.8u8.com/cl/index.html">回目录</A><BR><A
href="http://www.hjflying.8u8.com/index.htm">回首页</A><BR></STRONG></TD></TR></TBODY></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -