¶Á¡¶CºÍÖ¸Õë¡·±Ê¼ÇÕªÒª¡¾6¡¿
2010-04-09
µÚÊ®ÎåÕ ÊäÈë/Êä³öº¯Êý
1¡¢´íÎ󱨸æ
perrorº¯Êý void perror( char const *message);
2¡¢ÖÕÖ¹Ö´ÐÐ
void exit( int status ); ÔÐͶ¨ÒåÓÚstdlib.h
ÆäÖÐstatus²ÎÊý·µ»Ø¸ø²Ù×÷ϵͳ£¬ÓÃÓÚÌáʾ³ÌÐòÊÇ·ñÕý³£Íê³É£¬Õâ¸öÖµºÍmainº¯Êý·µ»ØµÄÕûÐÍ״ֵ̬Ïàͬ£¬Ô¤¶¨Òå·ûºÅEXIT_SUCESSºÍEXIT_FAILURE·Ö±ðÌáʾ³ÌÐòµÄÖÕÖ¹Êdzɹ¦»¹ÊÇʧ°Ü£»
3¡¢¶ÔCÓïÑÔ¶øÑÔ£¬ËùÓеÄI/O²Ù×÷֪ʶ¼òµ¥µØ´Ó³ÌÐòÒƽø»òÒƳö×Ö½ÚµÄÊÂÇ飬ºÁ²»¾ªÆæµÄÊÇ£¬ÕâÖÖ×Ö½ÚÁ÷±ã³ÆΪÁ÷£¬³ÌÐòÖ»¹ØÐÄ´´½¨ÕýÈ·µÄÊä³ö×Ö½ÚÊý¾Ý£¬ÒÔ¼°ÕýÈ·µÄ½âÊÍ´ÓÊäÈë¶ÁÈ¡µÄ×Ö½ÚÊý¾Ý£¬Ìض¨I/OÉ豸µÄϸ½Ú¶Ô³ÌÐòÔ±ÊÇÒþ²ØµÄ£»
4¡¢¾ø´ó¶àÊýÊÇÍêÈ«»º³åµÄ£¬Õâ¾ÍÒâζ×Å“¶ÁÈ¡”ºÍ“дÈë”ʵ¼ÊÉÏʱ´ÓÒ»¿é³ÆΪ»º³åÇøµÂÄÚ´æÇøÓòÀ´»Ø¸´ÖÆÊý¾Ý£»
5¡¢ÔÚ½øÐгÌÐòµ÷ÊÔʱ£¬ÔÚÿ¸öµ÷ÊÔµÄprintfº¯ÊýÖ®ºóÁ¢¼´µ÷ÓÃfflushº¯Êý£¬ÆÈʹ»º³åÇøµÄÊý¾ÝÁ¢¼´Ð´È룬²»¹ÜËüÊÇ·ñÒÑÂú£»
ÀýÈ磺printf( "something or other" );
fflush( stdout );
6¡¢Îı¾Á÷
Á÷·ÖΪÎı¾Á÷ºÍ¶þ½øÖÆÁ÷Á½ÖÖ£¬Îı¾Á÷µÄÓÐЩÌØÐÔ¿ÉÄÜÒòϵͳ²»Í¬¶ø²»Í¬£»
7¡¢±ê×¼C³ÌÐòÔËÐÐʱÖÁÉÙÌṩÈýÖÖÁ÷——±ê×¼ÊäÈ룬±ê×¼Êä³ö£¬±ê×¼³ö´í£¬¼´£ºstdin, stdout, stderr£»ËûÃǶ¼ÊÇÖ»ÏëÒ»¸öFILE½á¹¹µÄÖ¸Õ룻
8¡¢±ê×¼I/O³£Á¿
EOFËùÑ¡ÔñµÄʵ¼ÊÖµ±ÈÒ»¸ö×Ö·ûÒª¶à¼¸Î»£¬ÕâÊÇΪÁ˱ÜÃâ¶þ½øÖÆÖµ±»´íÎóµØ½âÊÍΪEOF£»
9¡¢´ò¿ªÁ÷
r, w, ºÍ a ¿ªÍ·£¬·Ö±ð±íʾ´ò¿ªµÄÁ÷ÓÃÓÚ¶ÁÈ¡£¬Ð´È뻹ÊÇÌí¼Ó£»Èç¹ûÒÔ¶Á·½Ê½´ò¿ª£¬ÔòÎļþ±ØÐë´æÔÚ£¬¶øÆäÓàµÄ·½Ê½Îļþ¿É´æÔÚ£¬¿É²»´æÔÚ£¬²»´æÔÚ½«´´½¨£»
10¡¢Èç¹ûÔÚmodeÖÐÌí¼Ó“a+”ÕâÖÖ·½Ê½µÄ»°£¬±íʾ¸ÃÎļþ´ò¿ªÓÃÓÚ¸üУ¬µ«µ±ÄãÒѾ´Ó¸ÃÎļþ¶ÁÈëÁËһЩÊý¾Ý£¬Èç¹ûÄãÒª¿ªÊ¼ÏòËûдÈëÊý¾Ýʱ£¬Äã±ØÐëÏȵ÷ÓÃÆäÖÐÒ»¸öÎļþ¶¨Î»º¯Êý£¨fseek, fsetpos, rewind£©£¬ÔÚÄãÏòÎļþдÈëÊý¾Ýºó£¬ÄãÓÖÏë¶ÁµÄ»°£¬ÄÇôÓÖÒªµ÷ÓÃfflush»òÎļþ¶¨Î»º¯ÊýÖ®Ò»£»
11¡¢freopenº¯ÊýÓÃÓÚ´ò¿ª£¨»òÖØдò¿ª£©Ò»¸öÌض¨µÄÎļþÁ÷
FILE * freopen( char const *filename, char const *mode, FILE *stream );
12¡¢¹Ø±ÕÁ÷
fcloseº¯Êý£¬¶ÔÓÚÊäÈëÁ÷£¬fcloseº¯ÊýÔÚÎļþ¹Ø±Õ֮ǰˢлº³åÇø£¬Èç¹ûËüÖ´Ðгɹ¦£¬fclose·µ»ØÁãÖµ£¬·ñÔò·µ»ØEOF£»
13¡¢×Ö·ûI/O
¢Ù int fgetc( FILE *stream );
¢Ú int getc( FILE *stream );
¢Û int getchar( );
ÕâЩ¶¼ÓÃÓÚ¶ÁÈ¡×Ö·û£¬µ«ËûÃǶ¼·µ»ØÒ»¸ö
Ïà¹ØÎĵµ£º
×¢ÒâÖ»Äܵ½2049Ä꣡
#define uchar unsigned char
#define uint unsigned int
#include <intrins.h>
/*
¹«ÀúÄê¶ÔÓ¦µÄÅ©ÀúÊý¾Ý,ÿÄêÈý×Ö½Ú,
¸ñʽµÚÒ»×Ö½ÚBIT7-4 λ±íʾÈòÔÂÔ·Ý,ֵΪ0 ΪÎÞÈòÔÂ,BIT3-0 ¶ÔӦũÀúµÚ1-4 ÔµĴóС
µÚ¶þ×Ö½ÚBIT7-0 ¶ÔӦũÀúµÚ5-12 Ô´óС,µÚÈý×Ö½ÚBIT7 ±íʾũÀúµÚ13 ¸öÔ´óÐ ......
1¡¢Ñ¡ÔñºÏÊʵÄËã·¨ºÍÊý¾Ý½á¹¹
Ñ¡ÔñÒ»ÖÖºÏÊʵÄÊý¾Ý½á¹¹ºÜÖØÒª£¬Èç¹ûÔÚÒ»¶ÑËæ»ú´æ·ÅµÄÊýÖÐʹÓÃÁË´óÁ¿µÄ²åÈëºÍɾ³ýÖ¸ÁÄÇʹÓÃÁ´±íÒª¿ìµÃ¶à¡£Êý×éÓëÖ¸ÕëÓï¾ä¾ßÓÐÊ®·ÖÃÜÇеĹØϵ£¬Ò»°ãÀ´Ëµ£¬Ö¸Õë±È½ÏÁé»î¼ò½à£¬¶øÊý×éÔò±È½ÏÖ±¹Û£¬ÈÝÒ×Àí½â¡£¶ÔÓڴ󲿷ֵıàÒëÆ÷£¬Ê¹ÓÃÖ¸Õë±ÈʹÓÃÊý×éÉú³ÉµÄ´úÂë¸ü¶Ì£¬Ö´ÐÐЧÂʸü¸ß¡£
ÔÚÐí¶à ......
——³õ²½ÉèÏë
¡¡×î½üÒ»Ö±ÔÚѧϰOSGI·½ÃæµÄ֪ʶ¡£ÂòÁËÒ»±¾¡¶OSGIÔÀíºÍ×î¼Ñʵ¼ù¡·£¬¿ÉÊÇ»¹Ã»Óе½¡£Òź¶µÄÊÇ£¬OSGIÄ¿Ç°µÄ¼¸¸ö¿ªÔ´¿ò¼ÜÖ»Ö§³ÖJava£¬¶ÔCºÍC++¶¼²»Ö§³ÖµÄ¡£¿ÉϧÎÒÃǹ«Ë¾Ä¿Ç°Ö÷ÒªµÄ¿ª·¢ÓïÑÔ»¹ÊÇcºÍc++£¬¼´±ãÊÇÒý½øOSGI£¬ËùµÃµÄºÃ´¦·¶Î§ÓÐÏÞ¡£¶øÎÒ¶ÔËÉÉ¢ñîºÏµÄÄ£¿é»¯¿ª·¢ÏòÍùÒѾᣲéÁËÒ»ÏÂOSGI¶ÔC++Ö§ ......
2010-04-09
µÚÊ®ËÄÕ Ԥ´¦ÀíÆ÷
1¡¢#define Ìæ»»
ÔÚ³ÌÐòÖÐÀ©Õ¹#define¶¨Òå·ûºÅºÍºêʱ£¬ÐèÒªÉæ¼°¼¸¸ö²½Ö裻
¢Ù¡¢ÔÚµ÷Óúêʱ£¬Ê×ÏȶԲÎÊý½øÐмì²é£¬¿´¿´ÊÇ·ñ°üº¬ÁËÈκÎÓÉ#define¶¨ÒåµÄ·ûºÅ£¬Èç¹ûÊÇ£¬ËüÃÇÊ×Ïȱ»Ìæ»»£»
¢Ú¡¢Ìæ»»ÎļþËæºó±»²åÈëµ½³ÌÐòÖÐÔÀ´ÎļþµÄλÖ㬶ÔÓں꣬²ÎÊýÃû±»ËûÃǵÄÖµÌæ´ú£»
¢Û¡¢×î ......
C µ÷ÓÃ Fortran
c2ffn.f
SUBROUTINE NAMEAGE(NAME, NLEN, AGE, TEMP)
CHARACTER*(*) NAME
INTEGER NLEN,AGE
REAL TEMP
C
WRITE(6,1000) NAME(1:NLEN),AGE,TEMP ......