C/C++——С±à̸CÓïÑÔº¯ÊýÄÇЩÊÂ(18)
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. raiseº¯Êý
raiseº¯ÊýµÄ¹¦ÄÜÊÇÏòÕýÔÚÖ´ÐеijÌÐò·¢ËÍÒ»¸öÐźţ¬ÆäÓ÷¨Îª£ºint raise(int sig);³ÌÐòʵÀýÈçÏ£º
#include <signal.h>
int main(void)
{
int a, b;
a = 10;
b = 0;
if (b == 0)
raise(SIGFPE);
a = a / b;
return 0;
}
2. removeº¯Êý
removeº¯ÊýµÄ¹¦ÄÜÊÇɾ³ýÒ»¸öÎļþ£¬ÆäÓ÷¨Îªint remove(char *filename);³ÌÐòʵÀý´úÂëÈçÏ£º
#include <stdio.h>
int main(void)
{
char file[80];
printf("File to delete: ");
gets(file);
if (remove(file) == 0)
printf("Removed %s.\n",file);
else
perror("remove");
return 0;
}
3. renameº¯Êý
renameº¯ÊýµÄ¹¦ÄÜÊÇÖØÃüÃûÎļþ, ÆäÓ÷¨Îª£ºint rename(char *oldname, char *newname);³ÌÐòʵÀý´úÂëÈçÏ£º
#include <stdio.h>
int main(void)
{
char oldname[80], newname[80];
printf("File to rename: ");
gets(oldname);
printf("New name: ");
gets(newname);
if (rename(oldname, newname) == 0)
printf("Renamed %s to %s.\n", oldname, newname);
else
perror("rename");
return 0;
}
4. rewindº¯Êý
rewindº¯ÊýµÄ¹¦ÄÜÊǽ«ÎļþÖ¸ÕëÖØÐÂÖ¸ÏòÒ»¸
Ïà¹ØÎĵµ£º
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. normvideoº¯Êý
mallocº¯ÊýµÄ¹¦ÄÜÊÇÑ¡ÔñÕý³£ÁÁ¶È×Ö·û£¬ÆäÓ÷¨Îª£ºvoid normvideo(void);³ÌÐòʵÀýÈçÏ£º
#include < ......
Óú¯Êýaccess£¬Í·ÎļþÊÇio.h£¬ÔÐÍ£º
int access(const char *filename, int amode);
amode²ÎÊýΪ0ʱ±íʾ¼ì²éÎļþµÄ´æÔÚÐÔ£¬Èç¹ûÎļþ´æÔÚ£¬·µ»Ø0£¬²»´æÔÚ£¬·µ»Ø-1¡£
Õâ¸öº¯Êý»¹¿ÉÒÔ¼ì²éÆäËüÎļþÊôÐÔ£º
06 &nbs ......
Cº¯ÊýÒªÔÚ³ÌÐòÖÐÓõ½ÒÔÏÂÕâЩºê:
void va_start( va_list arg_ptr, prev_param );
type va_arg( va_list arg_ptr, type );
void va_end( va_list arg_ptr );
va_list:ÓÃÀ´±£´æºêva_start¡¢va_argºÍva_endËùÐèÐÅÏ¢µÄÒ»ÖÖÀàÐÍ¡£ÎªÁË·ÃÎʱ䳤²ÎÊýÁбíÖеIJÎÊý£¬±ØÐëÉùÃ÷
& ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. registerbgidriverº¯Êý
registerbgidriverº¯ÊýµÄ¹¦ÄÜÊǵǼÒÑÁ¬½Ó½øÀ´µÄͼÐÎÇý¶¯³ÌÐò´úÂ룬ÆäÓ÷¨Îª£ºint registerbgidriver(void(*driver)(void ......