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

C¶ÁÈ¡ÎļþµÄÒ»ÐÐ

¸Õ¸ÕÍê³ÉµÄC¶ÁÈ¡ÎļþÒ»ÐÐÊý¾Ý£¬¿ÉÒÔ¶Á´óÁ¿Êý¾ÝµÄÐС£
/*
º¯Êý¹¦ÄÜ£º
   ¶ÁÈ¡ÎļþµÄÒ»ÐУ¬µ±¿ª±ÙÄÚ´æ²»¹»Ê±returnֵΪ-1,size»á¸ø³öÖÁÉÙÐèÒªµÄÄÚ´æ´óС£¬
      returnֵΪ1ʱ±íʾ´ËʱÎļþ½áÊø£¬´Óbuffer,sizeµÃµ½×îºóÒ»ÐеÄÊý¾ÝºÍ´óС¡£
ÊäÈë²ÎÊý£º
   stream£ºÎļþÁ÷
      size£ºbuffer´óС,¿ª±ÙÄÚ´æ´óС
Êä³ö²ÎÊý£º
      buffer£º´æ·ÅÒ»ÐÐ×Ö·û
      size£ºbuffer´óС£¬×Ö·ûÊýÄ¿
·µ»ØÖµ£º
   -1£º¶ÁÈ¡·¢Éú´íÎó
      0£º³É¹¦¶ÁÈ¡
      1: Îļþ½áÊø
±¸×¢£º
      2010.01.11
*/
int rtFGetLine(FILE *stream,char *buffer,int &size)
{
 static unsigned long offset = 0;
 
 bool fileend = 0;
 unsigned long bufsize = 1024;
 char *buf = NULL, *dest = NULL;
 unsigned short inc = 1;
 
 if(!stream || !buffer)
 {
  return -1;
 }
 while(1)
 {
  bufsize *= inc;
        buf = (char *)malloc(sizeof(char)*bufsize);
  if(NULL == buf)
  {
   return -1;
  }
  memset(buf,0x00,bufsize);
  fseek(stream,offset,SEEK_SET);  
  fread(buf,sizeof(char),bufsize,stream);
  if(ferror(stream))
  {
   return -1;
  }
 
  dest = strchr(buf,'\n');
  if(NULL == dest)
  {
   if( strlen(buf) >= bufsize - 1 )//¸ÃÐÐ×Ö·û´óÓÚbufsize
   {
    inc++;
    free(buf);
    buf = NULL;    
    continue;
   }
   
   if(feof(stream))//Îļþ°üº¬½áÊø±êÖ¾
   {         
  &nbs


Ïà¹ØÎĵµ£º

ÓÃCSocket´´½¨C/S½á¹¹

CSocketÅÉÉúÓÚCAsyncSocket, ËùÓÐÊ©ÖîÓÚÉϵIJÙ×÷½ÔΪͬ²½²Ù×÷¡£±ÈÈçConnnect,ReceiveµÈ¡£
ͬ²½²Ù×÷µÄÓŵãÊǼòµ¥Ò×Ó㬵«È±µãÒ²ÏÔ¶øÒ×¼û£¬Ð§ÂʵÍÏ£¬ÒòΪÄã±ØÐëµÈµ½Ò»¸ö²Ù×÷Íê³ÉÖ®ºó²ÅÄܽøÐÐÏÂÒ»¸ö²Ù×÷¡£
Èç¹ûÄãºÜ¹ØÐÄЧÂÊ£¬¾ÍÓ¦¸ÃÓÅÏÈʹÓÃCAsyncSocket¡£·´Ö®¾ÍÓÃCSocket¡£
ÏÂÃ潫˵Ã÷ÈçºÎÓÃCSocket´´½¨¼òµ¥µÄ·þÎñÆ÷ºÍ¿Í» ......

¶¨ÒåC/C++È«¾Ö±äÁ¿/³£Á¿¼¸ÖÖ·½·¨µÄÇø±ð£¨×ª£©


 
ÔÚÌÖÂÛÈ«¾Ö±äÁ¿Ö®Ç°ÎÒÃÇÏÈÒªÃ÷°×¼¸¸ö»ù±¾µÄ¸ÅÄ
1. ±àÒëµ¥Ôª(Ä£¿é)£º
    ÔÚIDE¿ª·¢¹¤¾ß´óÐÐÆäµÀµÄ½ñÌ죬¶ÔÓÚ±àÒëµÄһЩ¸ÅÄîºÜ¶àÈËÒѾ­²»ÔÙÇå³þÁË£¬ºÜ¶à³ÌÐòÔ±×îŵľÍÊÇ´¦ÀíÁ¬½Ó´íÎó(LINK ERROR), ÒòΪËü²»Ïñ±àÒë´íÎóÄÇÑù¿ÉÒÔ¸ø³öÄã³ÌÐò´íÎóµÄ¾ßÌåλÖã¬Äã³£³£¶ÔÕâÖÖ´íÎó¸Ðµ½°ÃÄÕ£¬µ«ÊÇÈç¹ûÄ ......

¾­µäC/C++ÃæÊÔÌ⣨¶þ£©

char str1[] = "abc";
char str2[] = "abc";
const char str3[] = "abc";
const char str4[] = "abc";
const char* str5 = "abc";
const char* str6 = "abc";
cout << boolalpha&nb ......

¡¾ÈëÃÅ¡¿ÓÃLinuxÖÐmanÃüÁî²éѯCº¯Êý

      ´ó¼Ò¶¼ÖªµÀÔÚUnix/LinuxÖÐÓиömanÃüÁ¿ÉÒÔ²éѯ³£ÓõÄÃüÁº¯Êý¡£¿ÉÊǶÔÓÚÎÒÃÇÕâÑùÖ»ÖªµÀÓÃ"man º¯ÊýÃû"À´²éѯµÄÈËÀ´Ëµ£¬»áÓöµ½ºÜ¶àÎÊÌ⣬±ÈÈ磺
      man read£¬ÎÒÏë¿´µÄÊÇANSI CÖÐstdioµÄreadº¯ÊýÔ­ÐͺÍ˵Ã÷£¬Ã»Ïëµ½³öÀ´µÄÈ·ÊÇBASHÃüÁîµÄ˵Ã÷£¬ÕâÊÇÔõô»ØÊ ......

anic£º±ÈC¿ì±ÈJava°²È«±Èshell»¹¼òµ¥µÄÐÂÓïÑÔ

һλIDΪultimusµÄ³ÌÐòÔ±¿ª·¢ÁËÒ»ÖÖÃûΪanicµÄÐÂÓïÑÔ£¬½üÈÕÒýÆðÒµ½ç¹Ø×¢¡£¸ù¾ÝGoogle CodeÉϸÃÏîÄ¿µÄ¼ò½é£¬¸ÃÓïÑÔµÄÕýʽÃû³ÆÊÇANI£¬anicÊÇÕâÖÖÓïÑԵIJο¼ÊµÏÖ¡£
ANIÊÇÒ»ÖÖʵÑéÐÔ¡¢¸ßÐÔÄÜ¡¢¾²Ì¬°²È«¡¢ÍêÈ«Òþº¬Ö§³Ö²¢ÐС¢ÃæÏò¶ÔÏóµÄͨÓÃÊý¾ÝÁ÷±à³ÌÓïÑÔ¡£
anicÓÃGNU¹¤¾ßÁ´Ð´³É£¬Òò´Ë¿ÉÒÆÖ²ÐԺܺ㬿ÉÒÔÔËÐÐÓÚËùÓÐÖ÷Á÷²Ù×÷ϵ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ