📄 fm.htm
字号:
return 0; <br>
} <br>
<br>
</p>
<p>函数名: mkdir <br>
功 能: 建立一个目录 <br>
用 法: int mkdir(char *pathname); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <conio.h> <br>
#include <process.h> <br>
#include <dir.h> </p>
<p>int main(void) <br>
{ <br>
int status; </p>
<p> clrscr(); <br>
status = mkdir("asdfjklm"); <br>
(!status) ? (printf("Directory
created\n")) : <br>
(printf("Unable to create directory\n")); </p>
<p> getch(); <br>
system("dir"); <br>
getch(); </p>
<p> status = rmdir("asdfjklm"); <br>
(!status) ? (printf("Directory
deleted\n")) : <br>
(perror("Unable to delete directory")); </p>
<p> return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: mktemp <br>
功 能: 建立唯一的文件名 <br>
用 法: char *mktemp(char *template); <br>
程序例: </p>
<p>#include <dir.h> <br>
#include <stdio.h> </p>
<p>int main(void) <br>
{ <br>
/* fname defines the template for the <br>
temporary file. */ </p>
<p> char *fname = "TXXXXXX", *ptr; </p>
<p> ptr = mktemp(fname); <br>
printf("%s\n",ptr); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: MK_FP <br>
功 能: 设置一个远指针 <br>
用 法: void far *MK_FP(unsigned seg, unsigned
off); <br>
程序例: </p>
<p>#include <dos.h> <br>
#include <graphics.h> </p>
<p>int main(void) <br>
{ <br>
int gd, gm, i; <br>
unsigned int far *screen; </p>
<p> detectgraph(&gd, &gm); <br>
if (gd == HERCMONO) <br>
screen =
MK_FP(0xB000, 0); <br>
else <br>
screen =
MK_FP(0xB800, 0); <br>
for (i=0; i<26; i++) <br>
screen[i] = 0x0700 + ('a'
+ i); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: modf <br>
功 能: 把数分为指数和尾数 <br>
用 法: double modf(double value, double *iptr); <br>
程序例: </p>
<p>#include <math.h> <br>
#include <stdio.h> </p>
<p>int main(void) <br>
{ <br>
double fraction, integer; <br>
double number = 100000.567; </p>
<p> fraction = modf(number, &integer); <br>
printf("The whole and fractional parts
of %lf are %lf and %lf\n", <br>
number, integer, fraction); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: movedata <br>
功 能: 拷贝字节 <br>
用 法: void movedata(int segsrc, int offsrc, int
segdest, <br>
int offdest, unsigned numbytes); <br>
程序例: </p>
<p>#include <mem.h> </p>
<p>#define MONO_BASE 0xB000 </p>
<p>/* saves the contents of the monochrome screen in
buffer */ <br>
void save_mono_screen(char near *buffer) <br>
{ <br>
movedata(MONO_BASE, 0, _DS,
(unsigned)buffer, 80*25*2); <br>
} </p>
<p>int main(void) <br>
{ <br>
char buf[80*25*2]; <br>
save_mono_screen(buf); <br>
} <br>
<br>
</p>
<p>函数名: moverel <br>
功 能: 将当前位置(CP)移动一相对距离 <br>
用 法: void far moverel(int dx, int dy); <br>
程序例: </p>
<p>#include <graphics.h> <br>
#include <stdlib.h> <br>
#include <stdio.h> <br>
#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
/* request auto detection */ <br>
int gdriver = DETECT, gmode, errorcode; <br>
char msg[80]; </p>
<p> /* initialize graphics and local
variables */ <br>
initgraph(&gdriver, &gmode,
""); </p>
<p> /* read result of initialization */ <br>
errorcode = graphresult(); <br>
if (errorcode != grOk) /* an error
occurred */ <br>
{ <br>
printf("Graphics
error: %s\n", grapherrormsg(errorcode)); <br>
printf("Press any key
to halt:"); <br>
getch(); <br>
exit(1); /* terminate with
an error code */ <br>
} </p>
<p> /* move the C.P. to location (20, 30) */ <br>
moveto(20, 30); </p>
<p> /* plot a pixel at the C.P. */ <br>
putpixel(getx(), gety(), getmaxcolor()); </p>
<p> /* create and output a message at (20,
30) */ <br>
sprintf(msg, " (%d, %d)", getx(),
gety()); <br>
outtextxy(20, 30, msg); </p>
<p> /* move to a point a relative distance */
<br>
/* away from the current value of C.P. */ <br>
moverel(100, 100); </p>
<p> /* plot a pixel at the C.P. */ <br>
putpixel(getx(), gety(), getmaxcolor()); </p>
<p> /* create and output a message at C.P. */
<br>
sprintf(msg, " (%d, %d)", getx(),
gety()); <br>
outtext(msg); </p>
<p> /* clean up */ <br>
getch(); <br>
closegraph(); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: movetext <br>
功 能:
将屏幕文本从一个矩形区域拷贝到另一个矩形区域
<br>
用 法: int movetext(int left, int top, int right,
int bottom, <br>
int newleft, int newtop); <br>
程序例: <br>
#include <conio.h> <br>
#include <string.h> </p>
<p>int main(void) <br>
{ <br>
char *str = "This is a test
string"; </p>
<p> clrscr(); <br>
cputs(str); <br>
getch(); </p>
<p> movetext(1, 1, strlen(str), 2, 10, 10); <br>
getch(); </p>
<p> return 0; <br>
} <br>
<br>
</p>
<p>函数名: moveto <br>
功 能: 将CP移到(x, y) <br>
用 法: void far moveto(int x, int y); <br>
程序例: </p>
<p>#include <graphics.h> <br>
#include <stdlib.h> <br>
#include <stdio.h> <br>
#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
/* request auto detection */ <br>
int gdriver = DETECT, gmode, errorcode; <br>
char msg[80]; </p>
<p> /* initialize graphics and local
variables */ <br>
initgraph(&gdriver, &gmode,
""); </p>
<p> /* read result of initialization */ <br>
errorcode = graphresult(); <br>
if (errorcode != grOk) /* an error
occurred */ <br>
{ <br>
printf("Graphics
error: %s\n", grapherrormsg(errorcode)); <br>
printf("Press any key
to halt:"); <br>
getch(); <br>
exit(1); /* terminate with
an error code */ <br>
} </p>
<p> /* move the C.P. to location (20, 30) */ <br>
moveto(20, 30); </p>
<p> /* plot a pixel at the C.P. */ <br>
putpixel(getx(), gety(), getmaxcolor()); </p>
<p> /* create and output a message at (20,
30) */ <br>
sprintf(msg, " (%d, %d)", getx(),
gety()); <br>
outtextxy(20, 30, msg); </p>
<p> /* move to (100, 100) */ <br>
moveto(100, 100); </p>
<p> /* plot a pixel at the C.P. */ <br>
putpixel(getx(), gety(), getmaxcolor()); </p>
<p> /* create and output a message at C.P. */
<br>
sprintf(msg, " (%d, %d)", getx(),
gety()); <br>
outtext(msg); </p>
<p> /* clean up */ <br>
getch(); <br>
closegraph(); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: movemem <br>
功 能: 移动一块字节 <br>
用 法: void movemem(void *source, void *destin,
unsigned len); <br>
程序例: </p>
<p>#include <mem.h> <br>
#include <alloc.h> <br>
#include <stdio.h> <br>
#include <string.h> </p>
<p>int main(void) <br>
{ <br>
char *source = "Borland
International"; <br>
char *destination; <br>
int length; </p>
<p> length = strlen(source); <br>
destination = malloc(length + 1); <br>
movmem(source,destination,length); <br>
printf("%s\n",destination); </p>
<p> return 0; <br>
} <br>
<br>
</p>
<p>函数名: normvideo <br>
功 能: 选择正常亮度字符 <br>
用 法: void normvideo(void); <br>
程序例: </p>
<p>#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
normvideo(); <br>
cprintf("NORMAL Intensity
Text\r\n"); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: nosound <br>
功 能: 关闭PC扬声器 <br>
用 法: void nosound(void); <br>
程序例: </p>
<p>/* Emits a 7-Hz tone for 10 seconds. </p>
<p> True story: 7 Hz is the
resonant frequency of a chicken's skull cavity. <br>
This was determined empirically
in Australia, where a new factory <br>
generating 7-Hz tones was
located too close to a chicken ranch: <br>
When the factory started up, all
the chickens died. </p>
<p> Your PC may not be able to
emit a 7-Hz tone. <br>
*/ </p>
<p>int main(void) <br>
{ <br>
sound(7); <br>
delay(10000); <br>
nosound(); <br>
} <br>
</p>
</td>
</tr>
</table>
</center></div><div align="center"><center>
<table border="0" cellspacing="1" width="640">
<tr>
<td class="p9" height="60"> <script>document.write("<p><a href=\"http://view.gznet.com/cgi-bin/rl_views.cgi?UID=10013421\" target=sxrl>");
document.write("<img src=\"http://refer.gznet.com/cgi-bin/rl_refer2.cgi?UID=10013421&refer="+escape(top.document.referrer)+"\" width=1 height=1 border=0 alt=\" \">");
document.write("</a>");
</script></td>
</tr>
</table>
</center></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -