C±ê×¼¿âº¯Êý
º¯ÊýÃû: abort
¹¦ ÄÜ: Òì³£ÖÕÖ¹Ò»¸ö½ø³Ì
ÓÃ ·¨: void abort(void);
³ÌÐòÀý:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Calling abort()\n");
abort();
return 0; /* This is never reached */
}
º¯ÊýÃû: abs
¹¦ ÄÜ: ÇóÕûÊýµÄ¾ø¶ÔÖµ
ÓÃ ·¨: int abs(int i);
³ÌÐòÀý:
#include <stdio.h>
#include <math.h>
int main(void)
{
int number = -1234;
printf("number: %d absolute value: %d\n", number, abs(number));
return 0;
}
º¯ÊýÃû: absread, abswirte
¹¦ ÄÜ: ¾ø¶Ô´ÅÅÌÉÈÇø¶Á¡¢Ð´Êý¾Ý
ÓÃ ·¨: int absread(int drive, int nsects, int sectno, void *buffer);
int abswrite(int drive, int nsects, in tsectno, void *buffer);
³ÌÐòÀý:
/* absread example */
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dos.h>
int main(void)
{
int i, strt, ch_out, sector;
char buf[512];
printf("Insert a diskette into drive A and press any key\n");
getch();
sector = 0;
if (absread(0, 1, sector, &buf) != 0)
{
perror("Disk problem");
exit(1);
}
printf("Read OK\n");
strt = 3;
for (i=0; i<80; i++)
{
ch_out = buf[strt+i];
putchar(ch_out);
}
printf("\n");
return(0);
}
º¯ÊýÃû: access
¹¦ ÄÜ: È·¶¨ÎļþµÄ·ÃÎÊȨÏÞ
ÓÃ ·¨: int access(const char *filename, int amode);
³ÌÐòÀý:
#include <stdio.h>
#include <io.h>
int file_exists(char *filename);
int main(void)
{
printf("Does NOTEXIST.FIL exist: %s\n",
file_exists("NOTEXISTS.FIL") ? "YES" : "NO");
Ïà¹ØÎĵµ£º
5¡¢#defineºê¶¨Òå¡£ºêÖ»ÊǼòµ¥µÄÎı¾Ìæ»»£¬ºÜÈÝÒ×ÒýÆðÆçÒå¡£
#include <stdio.h>
#define CONS(a,b) (int)(a##e##b)
#define STR(s) #s
int main()
{
printf(STR(vck));
printf("\n");
printf("%d\n",CONS(2,3));
return 0; ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. parsfnmº¯Êý
parsfnmº¯ÊýµÄ¹¦ÄÜÊÇ·ÖÎöÎļþÃû£¬ÆäÓ÷¨Îª£ºchar *parsfnm (char *cmdline, struct fcb *fcbptr, ......
Óú¯Êýaccess£¬Í·ÎļþÊÇio.h£¬ÔÐÍ£º
int access(const char *filename, int amode);
amode²ÎÊýΪ0ʱ±íʾ¼ì²éÎļþµÄ´æÔÚÐÔ£¬Èç¹ûÎļþ´æÔÚ£¬·µ»Ø0£¬²»´æÔÚ£¬·µ»Ø-1¡£
Õâ¸öº¯Êý»¹¿ÉÒÔ¼ì²éÆäËüÎļþÊôÐÔ£º
06 &nbs ......
2005-09-12 09:16
×÷ÕߣºËᦻª
³ö´¦£ºÌ켫Íø
ÔðÈα༣º·½ÖÛ
¡¡¡¡º¯Êýmax¿´ÆðÀ´¼ò½àÃ÷ÁË£¬µ«ÊÇʵ¼ÊÉÏprintfµÄʵÏÖÈ´Ô¶±ÈÕ⸴ÔÓ¡£maxº¯ÊýÖ®ËùÒÔ¿´ÆðÀ´¼òµ¥£¬ÊÇÒòΪ£º
¡¡¡¡(1) maxº¯Êý¿É±ä²ÎÊý±íµÄ³¤¶ÈÊÇÒÑÖªµÄ£¬Í¨¹ýnum²ÎÊý´«È룻
¡¡¡¡(2) maxº¯Êý¿É±ä²ÎÊý±íÖвÎÊýµÄÀàÐÍÊÇÒÑÖªµÄ£¬¶¼ÎªintÐÍ¡£
¡¡¡¡¶øprintfº¯ÊýÔ ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. raiseº¯Êý
raiseº¯ÊýµÄ¹¦ÄÜÊÇÏòÕýÔÚÖ´ÐеijÌÐò·¢ËÍÒ»¸öÐźţ¬ÆäÓ÷¨Îª£ºint raise(int sig);³ÌÐòʵÀýÈçÏ£º
#include <signal.h& ......