CÎļþ²Ù×÷һЩ×ܽá
1. Ê×ÏÈÒªÀí½â¼¸¸ö¸ÅÄ
Îļþ£º °´Ò»¶¨¹æÔò´æ´¢ÔÚ´ÅÅÌÉϵÄÊý¾Ý¼¯ºÏ¡£
ÎļþÃû£º ÄÜΨһ±êʶij¸ö´ÅÅÌÎļþµÄ×Ö·û´®¡£ÐÎʽ£º ÅÌ·û£º\ ·¾¶ \ ÎļþÃû.À©Õ¹Ãû
Îı¾Îļþ:£º Êý¾ÝÒÔÆäÊý×Ö×Ö·ûµÄASCIIÂëÐÎʽ¡¢Ò»¸ö×Ö½ÚÒ»¸ö×ֽڵش洢ÔÚ´ÅÅÌÉÏ¡£
¶þ½øÖÆÎļþ£ºÊý¾ÝÒÔ¶þ½øÖÆÐÎʽÔÚ´æ´¢ÔÚ´ÅÅÌÉÏ¡£
£¨Îı¾ÎļþºÍ¶þ½øÖÆÎļþ¾ßÌåÇø±ð¼ûǰһƪÎÄÕ£¬¸ÅÀ¨Îª¾ÍÊDZàÂ뷽ʽµÄÇø±ð£¬Ç°ÕßÊǹ̶¨³¤¶È±àÂë¡¢ºóÕßÊDZ䳤±àÂ룩
É豸Îļþ£ºÊäÈë/Êä³öÉ豸
±ê×¼ÊäÈëÎļþ£º¼üÅÌ
±ê×¼Êä³öÎļþ/±ê×¼´íÎóÊä³öÎļþ£ºÏÔʾÆ÷
ÎļþÐÍÖ¸Õ룺CÓïÑÔÊÇͨ¹ýÃûΪFILEµÄ½á¹¹ÐÍÖ¸ÕëÀ´¹ÜÀíÎļþ¶ÁдµÄ¡£FILE *<±äÁ¿Ãû>
ÎļþµÄ´ò¿ªºÍ¹Ø±Õ £ºÎļþ²Ù×÷ÏȽ¨Á¢ÎļþÓëÎļþÖ¸ÕëÖ®¼äµÄ¹Øϵ£¬½Ó׎øÐÐÎļþµÄ¶ÁÓëд¡£½¨Á¢ÎļþÓëÎļþÖ¸ÕëÖ®¼äµÄÁªÏµµÄ¹ý³ÌÊÇÎļþµÄ´ò¿ª¡£ÖÕÖ¹ÕâÖÖÁªÏµ¾ÍÊÇÎļþµÄ¹Ø±Õ¡£
FILE½á¹¹£º¶¨ÒåÔÚ¡´stdio.h¡µÖС£ÐÎʽÈçÏ£º
typedef struct
{
int _fd; /*Îļþ´úºÅ*/
int _cleft; /* Îļþ»º³åÇøËùÊ£×Ö½ÚÊý*/
int _mode; /* ÎļþʹÓÃģʽ*/
char *nextc; /* ÏÂÒ»¸öµÈ´ý´¦ÀíµÄ×Ö½ÚµØÖ·£¬ ¼´ÎļþÄÚ²¿Ö¸Õë*/
char *buff; /* Îļþ»º³åÇøÊ×µØÖ· */
}FILE;
2. Ö÷Òª²Ù×÷º¯ÊýÓÃÏàÓ¦µÄʹÓÃ
1) ÎļþµÄ´ò¿ªÓë¹Ø±Õ:
#include <stdio.h>
FILE *fp;
fp = fopen(char* filename, char* made);
if(fp == NULL)
{
exit(0);
}
fclose(fp)
modeºÍÖÖÀàÓÐ:
r : ´ò¿ªÒ»¸öÎı¾Îļþ,¹©¶ÁÈ¡Êý¾Ý, Îļþ²»´æÔÚ,Ôò·µ»ØNULL
w : ½¨Á¢Ò»¸ö¹©Ð´ÈëµÄÎı¾Îļþ. ·ÏÆúÔÓÐÄÚÈÝ
a: ´ò¿ª»ò½¨Á¢Ò»¸ö°ÑÊý¾Ý×·¼Óµ½ÎļþβµÄÎı¾Îļþ
r+: ¸üÐÂÊý¾Ý
w+ : ¸üÐÂÊý¾Ý,·ÏÆúÔÓÐÄÚÈÝ
a+ : ¸üÐÂÊý¾Ý, дÈëµÄÊý¾Ý×·¼Óµ½Îļþβ.
¶þ½øÖÆÔÚºóÃæ¼Ó"b"
±ê×¼ÊäÈë/Êä³öÎļþµÄÎļþÐÍÖ¸Õë: stdin, stdout, stderr
2) ÎļþµÄ¶ÁÓëд:
°ÑÒ»¸ö×Ö·ûдÈëÎļþ, »ò´ÓÎļþÖжÁÈ¡Ò»¸ö×Ö·û: ÎļþÄÚ²¿Ö¸Õë×Ô¶¯ÒÆÏòÏÂһλ¿É¶ÁдµÄλÖÃ
int fputc(char ch, FILE *fp); //³É¹¦·µ»ØдÈëµÄ×Ö·û£¬ ʧ°Ü·µ»ØEOF
int fgetc( FILE *fp) //³É¹¦Ôò·µ»ØдÈëµÄ×Ö·û
°ÑÒ»ÐÐÊý¾ÝдÈëÎļþ, »ò¶ÁÈ¡Ò»ÐÐÊý¾Ý:
int fputs(char *str, FILE *fp) //³É¹¦·µ»Ø0
c
Ïà¹ØÎĵµ£º
CRT È«³Æ£ºVisual C++ C RunTime Lib ¾ÍÊÇCÔËÐÐʱ¿â¡£
×¢£º ÒÔÏÂÄÚÈݲ¿·ÖÒý×ÔCSNDÖÐÏà¹ØÌÖÂÛµÄÌû×Ó£¬²¢½áºÏ×Ô¼ºµÄÀí½âÕûÀí¶ø³É¡£½ö¹©²Î¿¼¡£
1)ÔËÐÐʱ¿â¾ÍÊÇ C run-time library£¬ÊÇ C ¶ø·Ç C++ ÓïÑÔÊÀ½çµÄ¸ÅÄî:È¡Õâ¸öÃû×Ö¾ÍÊÇÒòΪÄãµÄ C ³ÌÐòÔËÐÐʱÐèÒªÕâЩ¿âÖеĺ¯Êý.
2)C ÓïÑÔÊÇËùνµÄ“СÄں˔ÓïÑÔ£¬¾ÍÆäÓ ......
extern "C"°üº¬Ë«Öغ¬Ò壬ÆäÒ»£º±»ËüÐÞÊεÄÄ¿±êÊÇ“extern”µÄ£»Æä¶þ£º±»ËüÐÞÊεÄÄ¿±êÊÇ“C”µÄ¡£
1£©±»extern “C”ÏÞ¶¨µÄº¯Êý»ò±äÁ¿ÊÇexternÀàÐ͵ģ»
externÊÇC/C++ÓïÑÔÖбíÃ÷º¯ÊýºÍÈ«¾Ö±äÁ¿×÷Ó÷¶Î§£¨¿É¼ûÐÔ£©µÄ¹Ø¼ü×Ö£¬¸Ã¹Ø¼ü×Ö¸æËß±àÒëÆ÷£¬ÆäÉùÃ÷µÄº¯ÊýºÍ±äÁ¿¿É ......
ÔÚÇ°ÃæµÄ»ù´¡ÉÏ£¬ÏÂÃ濪ʼÀûÓÃskyeye×Ô´øµÄtestsuitesÖеÄ×ÊÔ´À´ÔËÐÐ×Ô¼ºµÄ³ÌÐòµÄ·½·¨
1.Ê×ÏÈÊÇÏÂÔØÏÂÔØskyeye-1.2.5_REL.tar.gz£¬È»ºó½âѹ¸ÃÎļþ
2.ʹÓÃskyeyeÄ£Äâ°å×Ós3c2410ÔËÐÐij¸ölinux
Ê×ÏȽøÈë½âѹÍêµÄĿ¼£¬È»ºó
cd ./linux/s3c2410/s3c2410x-2.6.14
skyeye –c skyeye.conf –e vmlinux
×¢ÒâµÄÊÇs ......
typedefΪCÓïÑԵĹؼü×Ö£¬×÷ÓÃÊÇΪһÖÖÊý¾ÝÀàÐͶ¨ÒåÒ»¸öÐÂÃû×Ö¡£µ±typedefÓë½á¹¹½áºÏʹÓÃʱ£¬»áÓÐһЩ±È½Ï¸´ÔÓµÄÇé¿ö£¬¶øÇÒÔÚCÓïÑÔºÍC++ÀïÃæÂÔÓвî±ð£¬±¾ÎĽ«Ïêϸ½²½âtypedef structµÄÓ÷¨¡£
µÚÒ»Õ typedef struct Óë structµÄÇø±ð
1. »ù±¾½âÊÍ
ty ......
CÏÝÚåÓÚȱÏÝÕâ±¾Ê鵽ͼÊé¹Ý½èÁ˺ܾã¬Ò»Ö±¶¼Ã»ÓÐϸϸµÄ¿´£¬ÏÖÍêÕûµÄ¿´ÁËÖ®ºó°ÑÈÏΪÖØÒªµÄ£¬Ò»°ãÈË¿ÉÄܺöÊÓµÄÎÊÌâ¸ø×öÁ˱ʼǣ¬Ï£ÍûÓÐËù°ïÖú
2010.02.25
¶þάÊý×é:
int calendar[12][31];
int * p;
int i;
calendar[4]µÄº¬Ò壺
calendar[4]ÊÇcalendarÊý×éµÄµÚ5¸öÔªËØ£¬ÊÇcalendarÊý×éÖÐ12¸öÓÐ×Å31¸öÕûÐÍÔªËصÄÊý×éÖ®Ò» ......