Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

CÖжÁÎļþ

À´×Ô£ºhttp://blogger.org.cn/blog/more.asp?name=binaryluo&id=11408
CÎļþ²Ù×÷Óöµ½µÄ×´¿ö
1.½«Ò»¸öÎļþ¶Áµ½ÁíÒ»¸öÎļþ£¬ÓÓ(ch = getc(fp)) != EOF”À´ÅжÏÎļþÊÇ·ñ½áÊø£¬Èç¹ûÎļþÊÇÈ«Ó¢ÎÄÎı¾µÄ»°¾ø¶ÔûÎÊÌ⣬ÐÂÎļþµÄ´óСºÍÔ­Îļþ´óСһÑù£»µ«ÊÇÈç¹ûÊÇһЩÓÐÖÐÎÄ×Ö·û»òÕßÊǶþ½øÖÆÎļþ£¬Ô­Îļþû¶ÁÍê¾Í½áÊø¡£
2.½«Ò»¸öÎļþ¶Áµ½ÁíÒ»¸öÎļþ£¬ÓÓ!feof(fp)”ÅжÏÎļþÊÇ·ñ½áÊø£¬²»¹ÜÔ­ÎļþÊÇʲôÀàÐ͵Ķ¼¿ÉÒÔ½«Ô­ÎļþÈ«²¿¶ÁÍê²Å½áÊø£¬µ«ÊÇÐÂÎļþµÄ´óС±ÈÔ­Îļþ¶àÁËÒ»¸ö×Ö½Ú¡£
ÎÊÌ⣺ÔÚCÀïÈçºÎ²ÅÄÜÕýÈ·ÅжÏÎļþ½áÊø£¿£¿
̽Ë÷
²âÊÔÒ»£¬ÎÒдÁËÒ»¸öº¯ÊýÀ´ÊÔÓÃEOFÅжÏÎļþ½áÊøµÄÇé¿ö£º
-------in.txtÄÚÈÝÈçÏÂ---------
abcde
-------in.txt½áÊø-------------
-------test1.c----------------
int main(int argc, char* argv[]){
    char ch;
    FILE* in;
    FILE* out;
    
    in = fopen("in.txt", "rb");  /* in.txtȫΪӢÎÄ×Ö·û */
    out = fopen("out.txt", "wb");
    while ((ch = getc(in)) != EOF){
         putc(ch, out);
    }
}
ÔËÐкó½á¹ûÊÇ£ºout.txtµÄ´óСºÍin.txtµÄ´óСÍêÈ«Ò»Ñù¡£
È»ºóÐÞ¸Äin.txtÈçÏ£¬ÔÚÔ­À´µÄ»ù´¡ÉϼÓÈëһЩÖÐÎÄ£º
-------in.txtÐ޸ĺóµÄÄÚÈÝÈçÏÂ---------
abcde
ÕâÊÇÒ»¸ö²âÊÔÎļþ
²âÊÔÖÐÎÄ×Ö·û
-------in.txt½áÊø--------------------
ÔËÐкó¼Ç¹ýÒ²ÊÇ´óСÊÇÒ»ÑùµÄ¡£½«Ô´³ÌÐòÖеēin = fopen("in.txt", "rb");out = fopen("out.txt", "w");”¸ÄΪ“in = fopen("in.rar", "rb");out = fopen("out.rar", "wb");”£¬ÆäÖУ¬in.rarÊÇÒ»¸öѹËõ°üÎļþ£¬´óСÓÐ4M¶à£¬ÔËÐгÌÐòºó£¬µÃµ½µÄout.rarÎļþÖ»ÓÐ800¶àk£¬Ë«»÷½âѹҲ³öÏÖ´íÎó£¬ÎÞ·¨½âѹ¡£
½áÂÛ1£ºÔÚCÀ²Ù×÷ÎļþµÄʱºò£¬Èç¹û´ò¿ª·½Ê½ÊÇ“r”»òÕß“w”£¬ÊÇÒÔÎı¾ÐÎʽ´ò¿ª£¬Ò²¾ÍÊǶÁÈçÄÚ´æµÄ×Ö·ûÖµ¶¼ÊÇ0£­256Ö®¼ä£¬²»¿ÉÄܳöÏÖ£­1£¬Ëù


Ïà¹ØÎĵµ£º

C/C++ extern

externÊÇC/C++ÓïÑÔÖбíÃ÷º¯ÊýºÍÈ«¾Ö±äÁ¿×÷Ó÷¶Î§£¨¿É¼ûÐÔ£©µÄ¹Ø¼ü×Ö´´Òâ²úÆ·Íø .
Ëü¸æËß±àÒëÆ÷£¬ÆäÉùÃ÷µÄº¯ÊýºÍ±äÁ¿¿ÉÒÔÔÚ±¾Ä£¿é»òÆäËüÄ£¿éÖÐʹÓá£
1¡£¶ÔÓÚextern±äÁ¿À´Ëµ£¬½ö½öÊÇÒ»¸ö±äÁ¿µÄÉùÃ÷£¬Æä²¢²»ÊÇÔÚ¶¨Òå·ÖÅäÄÚ´æ¿Õ¼ä¡£Èç¹û¸Ã±äÁ¿¶¨Òå¶à´Î£¬»áÓÐÁ¬½Ó´íÎó
2¡£Í¨³££¬ÔÚÄ£¿éµÄÍ·ÎļþÖжԱ¾Ä£¿éÌṩ¸øÆäËüÄ£¿éÒýÓõ ......

c³ÌÐòʵÏÖÏãÅ©±àÂë

#include <stdio.h>
#include <math.h>
#include <string.h>
int i,j,n,k,b;
float addp;
char bitw[20];
/*³õʼ»¯½á¹¹ÌåÆäÖУºsΪÐÅÔ´·ûºÅ£»pΪÐÅÔ´·ûºÅ¸ÅÂÊ£»paddΪÀÛ¼Ó¸ÅÂÊ£»
l_fΪ-log[p(s[i])]¼´¹À¼ÆÂë×Ö³¤¶È£»lΪʵ¼ÊÐèÒªÂë×Ö³¤¶È£»wΪÂë×Ö*/
 struct shan
 {char s[20];
&nbs ......

GNU C __attribute__ »úÖƼò½é

GNU C __attribute__ »úÖƼò½é
2006-06-17 13:54:00
¡¡±êÇ©£º¡¡¡¡¡¡[ÍÆË͵½¼¼ÊõȦ]
ͻ񻣼
ÔÚѧϰlinuxÄں˴úÂ뼰һЩ¿ªÔ´Èí¼þµÄÔ´Â루È磺DirectFB£©£¬¾­³£¿ÉÒÔ¿´µ½ÓйØ__attribute__µÄÏà¹ØʹÓᣱ¾ÎĽáºÏ×Ô¼ºµÄѧϰ¾­Àú£¬½ÏΪÏêϸµÄ½éÉÜÁË__attribute__Ïà¹ØÓï·¨¼°ÆäʹÓá£
-------------------------------------- ......

Linux C + + Training


Linux C + + Training
Syllabus
________________________________________
1, Linux Operating System
System Environment: Ubuntu GNU / Linux, RedHat Linux AS5,
FreeBSD
Course Requirements: proficient use of commonly used Linux
/ UNIX commands.
Time: 1 week.
______________________________ ......

³¹µ×¸ã¶¨CÖ¸Õ룭º¯ÊýÃûÓ뺯ÊýÖ¸Õë

º¯ÊýÃûÓ뺯ÊýÖ¸Õë
Ò» ͨ³£µÄº¯Êýµ÷ÓÃ
    Ò»¸öͨ³£µÄº¯Êýµ÷ÓõÄÀý×Ó£º
//×ÔÐаüº¬Í·Îļþ
void MyFun(int x);    //´Ë´¦µÄÉêÃ÷Ò²¿Éд³É£ºvoid MyFun( int );
int main(int argc, char* argv[])
{
   MyFun(10);     //ÕâÀïÊǵ÷ÓÃMy ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ