C/C++——С±à̸CÓïÑÔº¯ÊýÄÇЩÊÂ(10)
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. initgraphº¯Êý
initgraphº¯ÊýÊdzõʼ»¯Í¼ÐÎϵͳ£¬ÆäÓ÷¨Îª£ºvoid far initgraph(int far *graphdriver, int far *graphmode,char far *pathtodriver); ³ÌÐòÀý×ÓÈçÏ£º
include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk) {
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
line(0, 0, getmaxx(), getmaxy());
getch();
closegraph();
return 0;
}
2. intdosº¯Êý
intdosº¯ÊýÊÇͨÓÃDOS½Ó¿Ú£¬ÆäÓ÷¨Îª£ºint intdos(union REGS *inregs, union REGS *outregs); ³ÌÐòÀý×ÓÈçÏ£º
#include <stdio.h>
#include <dos.h>
/* deletes file name; returns 0 on success, nonzero on failure */
int delete_file(char near *filename)
{
union REGS regs;
int ret;
regs.h.ah = 0x41; /* delete file */
regs.x.dx = (unsigned) filename;
ret = intdos(®s, ®s);
/* if carry flag is set, there was an error */
return(regs.x.cflag ? ret : 0);
}
int main(void)
{
int err;
err = delete_file("NOTEXIST.$$$");
if (!err)
Ïà¹ØÎĵµ£º
Ò»¸ö¶¨ÒåΪvolatileµÄ±äÁ¿ÊÇ˵Õâ±äÁ¿¿ÉÄܻᱻÒâÏë²»µ½µØ¸Ä±ä£¬ÕâÑù£¬±àÒëÆ÷¾Í²»»áÈ¥¼ÙÉèÕâ¸ö±äÁ¿µÄÖµÁË¡£¾«È·µØ˵¾ÍÊÇ£¬ÓÅ»¯Æ÷ÔÚÓõ½Õâ¸ö±äÁ¿Ê±±ØÐëÿ´Î¶¼Ð¡ÐĵØÖØжÁÈ¡Õâ¸ö±äÁ¿µÄÖµ£¬¶ø²»ÊÇʹÓñ£´æÔڼĴæÆ÷ÀïµÄ±¸·Ý¡£ÏÂÃæÊÇvolatile±äÁ¿µÄ¼¸¸öÀý×Ó£º
1). ²¢ÐÐÉ豸µÄÓ²¼þ¼Ä´æÆ÷£¨È磺״̬¼Ä´æÆ ......
ÔÚNotes µÄC/S ±à³ÌÖУ¬¾³£ÐèÒª¶ÔÒ»¸ö¼¯ºÏÖеĶÔÏó½øÐбéÀú´¦Àí£¬ÕâʱÈç¹ûÄÜÏÔʾһ¸ö½ø¶ÈÌõָʾµ±Ç°´¦Àí½ø³Ì£¬¾Í±È½ÏÖ±¹ÛÐÎÏ󣬿ͻ§½çÃæÒ²±È½ÏÓѺá£
1¡¢ÉùÃ÷APIº¯Êý
'ÉùÃ÷APIº¯Êý
Declare Function NEMProgressBegin Lib&nbs ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. fcloseº¯Êý
fcloseº¯ÊýµÄ¹¦ÄÜÊǹرÕÒ»¸öÁ÷£¬ÆäÓ÷¨ÊÇ£ºint fclose(FILE *stream); ³ÌÐòÀý×ÓÈçÏ£º
#include <string.h& ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. harderrº¯Êý
harderrº¯ÊýµÄ¹¦ÄÜÊǽ¨Á¢Ò»¸öÓ²¼þ´íÎó´¦Àí³ÌÐò£¬ÆäÓ÷¨ÊÇ£ºvoid harderr(int (*fptr)());³ÌÐòÀý×ÓÈçÏ£º
#include <stdio.h>
......