📄 m.htm
字号:
功 能: 建立一个目录
用 法: int mkdir(char *pathname);
程序例: </PRE>
<PRE>#include
#include
#include
#include </PRE>
<PRE>int main(void)
{
int status; </PRE>
<PRE>clrscr();
status = mkdir("asdfjklm");
(!status) ? (printf("Directory created\n")) :
(printf("Unable to create directory\n")); </PRE>
<PRE>getch();
system("dir");
getch(); </PRE>
<PRE>status = rmdir("asdfjklm");
(!status) ? (printf("Directory deleted\n")) :
(perror("Unable to delete directory")); </PRE>
<PRE>return 0;
}
</PRE>
<PRE>函数名: <font size="5" color="#FF0000">mktemp </font>
功 能: 建立唯一的文件名
用 法: char *mktemp(char *template);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>int main(void)
{
/* fname defines the template for the
temporary file. */ </PRE>
<PRE>char *fname = "TXXXXXX", *ptr; </PRE>
<PRE>ptr = mktemp(fname);
printf("%s\n",ptr);
return 0;
}
</PRE>
<PRE>函数名:<font size="5" color="#FF0000"> MK_FP </font>
功 能: 设置一个远指针
用 法: void far *MK_FP(unsigned seg, unsigned off);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>int main(void)
{
int gd, gm, i;
unsigned int far *screen; </PRE>
<PRE>detectgraph(&gd, &gm);
if (gd == HERCMONO)
screen = MK_FP(0xB000, 0);
else
screen = MK_FP(0xB800, 0);
for (i=0; i<26; i++)
screen[i] = 0x0700 + ('a' + i);
return 0;
}
</PRE>
<PRE>函数名: <font size="5" color="#FF0000">modf </font>
功 能: 把数分为指数和尾数
用 法: double modf(double value, double *iptr);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>int main(void)
{
double fraction, integer;
double number = 100000.567; </PRE>
<PRE>fraction = modf(number, &integer);
printf("The whole and fractional parts of %lf are %lf and %lf\n",
number, integer, fraction);
return 0;
}
</PRE>
<PRE>函数名:<font size="5" color="#FF0000"> movedata </font>
功 能: 拷贝字节
用 法: void movedata(int segsrc, int offsrc, int segdest,
int offdest, unsigned numbytes);
程序例: </PRE>
<PRE>#include </PRE>
<PRE>#define MONO_BASE 0xB000 </PRE>
<PRE>/* saves the contents of the monochrome screen in buffer */
void save_mono_screen(char near *buffer)
{
movedata(MONO_BASE, 0, _DS, (unsigned)buffer, 80*25*2);
} </PRE>
<PRE>int main(void)
{
char buf[80*25*2];
save_mono_screen(buf);
}
</PRE>
<PRE>函数名:<font size="5" color="#FF0000"> moverel </font>
功 能: 将当前位置(CP)移动一相对距离
用 法: void far moverel(int dx, int dy);
程序例: </PRE>
<PRE>#include
#include
#include
#include </PRE>
<PRE>int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
char msg[80]; </PRE>
<PRE>/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, ""); </PRE>
<PRE>/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
} </PRE>
<PRE>/* move the C.P. to location (20, 30) */
moveto(20, 30); </PRE>
<PRE>/* plot a pixel at the C.P. */
putpixel(getx(), gety(), getmaxcolor()); </PRE>
<PRE>/* create and output a message at (20, 30) */
sprintf(msg, " (%d, %d)", getx(), gety());
outtextxy(20, 30, msg); </PRE>
<PRE>/* move to a point a relative distance */
/* away from the current value of C.P. */
moverel(100, 100); </PRE>
<PRE>/* plot a pixel at the C.P. */
putpixel(getx(), gety(), getmaxcolor()); </PRE>
<PRE>/* create and output a message at C.P. */
sprintf(msg, " (%d, %d)", getx(), gety());
outtext(msg); </PRE>
<PRE>/* clean up */
getch();
closegraph();
return 0;
}
</PRE>
<PRE>函数名: <font size="5" color="#FF0000">movetext </font>
功 能: 将屏幕文本从一个矩形区域拷贝到另一个矩形区域
用 法: int movetext(int left, int top, int right, int bottom,
int newleft, int newtop);
程序例:
#include
#include </PRE>
<PRE>int main(void)
{
char *str = "This is a test string"; </PRE>
<PRE>clrscr();
cputs(str);
getch(); </PRE>
<PRE>movetext(1, 1, strlen(str), 2, 10, 10);
getch(); </PRE>
<PRE>return 0;
}
</PRE>
<PRE>函数名: <font size="5" color="#FF0000">moveto </font>
功 能: 将CP移到(x, y)
用 法: void far moveto(int x, int y);
程序例: </PRE>
<PRE>#include
#include
#include
#include </PRE>
<PRE>int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
char msg[80]; </PRE>
<PRE>/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, ""); </PRE>
<PRE>/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
} </PRE>
<PRE>/* move the C.P. to location (20, 30) */
moveto(20, 30); </PRE>
<PRE>/* plot a pixel at the C.P. */
putpixel(getx(), gety(), getmaxcolor()); </PRE>
<PRE>/* create and output a message at (20, 30) */
sprintf(msg, " (%d, %d)", getx(), gety());
outtextxy(20, 30, msg); </PRE>
<PRE>/* move to (100, 100) */
moveto(100, 100); </PRE>
<PRE>/* plot a pixel at the C.P. */
putpixel(getx(), gety(), getmaxcolor()); </PRE>
<PRE>/* create and output a message at C.P. */
sprintf(msg, " (%d, %d)", getx(), gety());
outtext(msg); </PRE>
<PRE>/* clean up */
getch();
closegraph();
return 0;
}
</PRE>
<PRE>函数名:<font size="5" color="#FF0000"> movemem </font>
功 能: 移动一块字节
用 法: void movemem(void *source, void *destin, unsigned len);
程序例: </PRE>
<PRE>#include
#include
#include
#include </PRE>
<PRE>int main(void)
{
char *source = "Borland International";
char *destination;
int length; </PRE>
<PRE>length = strlen(source);
destination = malloc(length + 1);
movmem(source,destination,length);
printf("%s\n",destination); </PRE>
<PRE>return 0;
}
</PRE>
<PRE><font size="5"><a href="a.htm">A</a> <a href="b.htm">B</a> <a href="c.htm">C</a> <a href="d.htm">D</a> <a href="e.htm">E</a> <a href="f.htm">F</a> <a href="g.htm">G</a> <a href="h.htm">H</a> <a href="i.htm">I</a> <a href="k.htm">K</a> <a href="l.htm">L</a> <a href="m.htm">M</a> <a href="n.htm">N</a> <a href="o.htm">O</a> <a href="p.htm">P</a> <a href="q.htm">Q</a> <a href="r.htm">R</a> <a href="s.htm">S</a> <a href="t.htm">T</a> <a href="u.htm">U</a> <a href="v.htm">V</a> <a href="w.htm">W</a> </font></PRE>
<PRE> </PRE>
<PRE></PRE>
<PRE>资料收集:beck Copyright 2004 张求熙, All Rights Reserved</PRE>
<pre><a href="mailto:Email:qiuxi1984@126.com">Email:qiuxi1984@126.com</a> QQ:35540948 </pre>
<PRE> </PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -