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ÅÉÉúÓÚCAsyncSocket, ËùÓÐÊ©ÖîÓÚÉϵIJÙ×÷½ÔΪͬ²½²Ù×÷¡£±ÈÈçConnnect,ReceiveµÈ¡£
ͬ²½²Ù×÷µÄÓŵãÊǼòµ¥Ò×Ó㬵«È±µãÒ²ÏÔ¶øÒ×¼û£¬Ð§ÂʵÍÏ£¬ÒòΪÄã±ØÐëµÈµ½Ò»¸ö²Ù×÷Íê³ÉÖ®ºó²ÅÄܽøÐÐÏÂÒ»¸ö²Ù×÷¡£
Èç¹ûÄãºÜ¹ØÐÄЧÂÊ£¬¾ÍÓ¦¸ÃÓÅÏÈʹÓÃCAsyncSocket¡£·´Ö®¾ÍÓÃCSocket¡£
ÏÂÃ潫˵Ã÷ÈçºÎÓÃCSocket´´½¨¼òµ¥µÄ·þÎñÆ÷ºÍ¿Í» ......
ÔÚÌÖÂÛÈ«¾Ö±äÁ¿Ö®Ç°ÎÒÃÇÏÈÒªÃ÷°×¼¸¸ö»ù±¾µÄ¸ÅÄ
1. ±àÒëµ¥Ôª(Ä£¿é)£º
ÔÚIDE¿ª·¢¹¤¾ß´óÐÐÆäµÀµÄ½ñÌ죬¶ÔÓÚ±àÒëµÄһЩ¸ÅÄîºÜ¶àÈËÒѾ²»ÔÙÇå³þÁË£¬ºÜ¶à³ÌÐòÔ±×îŵľÍÊÇ´¦ÀíÁ¬½Ó´íÎó(LINK ERROR), ÒòΪËü²»Ïñ±àÒë´íÎóÄÇÑù¿ÉÒÔ¸ø³öÄã³ÌÐò´íÎóµÄ¾ßÌåλÖã¬Äã³£³£¶ÔÕâÖÖ´íÎó¸Ðµ½°ÃÄÕ£¬µ«ÊÇÈç¹ûÄ ......
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 ......
´ó¼Ò¶¼ÖªµÀÔÚUnix/LinuxÖÐÓиömanÃüÁ¿ÉÒÔ²éѯ³£ÓõÄÃüÁº¯Êý¡£¿ÉÊǶÔÓÚÎÒÃÇÕâÑùÖ»ÖªµÀÓÃ"man º¯ÊýÃû"À´²éѯµÄÈËÀ´Ëµ£¬»áÓöµ½ºÜ¶àÎÊÌ⣬±ÈÈ磺
man read£¬ÎÒÏë¿´µÄÊÇANSI CÖÐstdioµÄreadº¯ÊýÔÐͺÍ˵Ã÷£¬Ã»Ïëµ½³öÀ´µÄÈ·ÊÇBASHÃüÁîµÄ˵Ã÷£¬ÕâÊÇÔõô»ØÊ ......
һλIDΪultimusµÄ³ÌÐòÔ±¿ª·¢ÁËÒ»ÖÖÃûΪanicµÄÐÂÓïÑÔ£¬½üÈÕÒýÆðÒµ½ç¹Ø×¢¡£¸ù¾ÝGoogle CodeÉϸÃÏîÄ¿µÄ¼ò½é£¬¸ÃÓïÑÔµÄÕýʽÃû³ÆÊÇANI£¬anicÊÇÕâÖÖÓïÑԵIJο¼ÊµÏÖ¡£
ANIÊÇÒ»ÖÖʵÑéÐÔ¡¢¸ßÐÔÄÜ¡¢¾²Ì¬°²È«¡¢ÍêÈ«Òþº¬Ö§³Ö²¢ÐС¢ÃæÏò¶ÔÏóµÄͨÓÃÊý¾ÝÁ÷±à³ÌÓïÑÔ¡£
anicÓÃGNU¹¤¾ßÁ´Ð´³É£¬Òò´Ë¿ÉÒÆÖ²ÐԺܺ㬿ÉÒÔÔËÐÐÓÚËùÓÐÖ÷Á÷²Ù×÷ϵ ......