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º¯ÊýµÄ¹¦ÄÜÊǽ«ÎļþÖ¸ÕëÖØÐÂÖ¸ÏòÒ»¸
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. ldexpº¯Êý
ldexpº¯ÊýµÄ¹¦ÄÜÊǼÆËãvalue*2µÄÃÝ£¬ÆäÓ÷¨Îª£ºdouble ldexp(double value, int exp);³ÌÐòʵÀýÈçÏ£º
......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. normvideoº¯Êý
mallocº¯ÊýµÄ¹¦ÄÜÊÇÑ¡ÔñÕý³£ÁÁ¶È×Ö·û£¬ÆäÓ÷¨Îª£ºvoid normvideo(void);³ÌÐòʵÀýÈçÏ£º
#include < ......
#include <iostream>
#include <io.h>
#include <sys\stat.h>
#include <afx.h>
#define _AFXDLL
using namespace std;
void main()
{
// ´ËÎļþÔÚ¹¤³Ì´ò¿ª×´Ì¬ÏÂΪ²»¿É·ÃÎÊ
char* f ......
2005-09-12 09:16
×÷ÕߣºËᦻª
³ö´¦£ºÌ켫Íø
ÔðÈα༣º·½ÖÛ
¡¡¡¡º¯Êýmax¿´ÆðÀ´¼ò½àÃ÷ÁË£¬µ«ÊÇʵ¼ÊÉÏprintfµÄʵÏÖÈ´Ô¶±ÈÕ⸴ÔÓ¡£maxº¯ÊýÖ®ËùÒÔ¿´ÆðÀ´¼òµ¥£¬ÊÇÒòΪ£º
¡¡¡¡(1) maxº¯Êý¿É±ä²ÎÊý±íµÄ³¤¶ÈÊÇÒÑÖªµÄ£¬Í¨¹ýnum²ÎÊý´«È룻
¡¡¡¡(2) maxº¯Êý¿É±ä²ÎÊý±íÖвÎÊýµÄÀàÐÍÊÇÒÑÖªµÄ£¬¶¼ÎªintÐÍ¡£
¡¡¡¡¶øprintfº¯ÊýÔ ......