CºÍC++»ñÈ¡Îļþ´óСµÄ·½·¨×ܽᣨת£©
1.MFCÖеķ½·¨£º(C++) CFileStatus status;
CFile::GetStatus("D:\\test.txt",status);
long lSizeOfFile;
lSizeOfFile = status.m_size; lSizeOfFileµÄÖµ¾ÍÊÇD:\\test.txtÎļþµÄ´óС 2.±ê×¼C»ñµÃÎļþ´óСµÄ5ÖÖ·½·¨
(×¢Ò⣺"__FILE__"Ö¸µÄÊǵ±Ç°Îļþ£¬Äã¿ÉÒÔ¸ÄΪÓÐЧ·¾¶µÄÄ¿±êÎļþ£¬±ÈÈç"D:\\test.txt"£©
#include "stdafx.h"
#include "stdio.h"
#include
#include
#include int getfilesize()
{
int iresult;
struct _stat buf;
iresult = _stat(__FILE__,&buf);
if(iresult == 0)
{
return buf.st_size;
}
return NULL;
} int getfilesize01()
{
int fp;
fp=_open(__FILE__,_O_RDONLY);
if(fp==-1)
return NULL;
return _filelength(fp);
//return NULL;
} int getfilesize02()
{
int fp;
fp=_open(__FILE__,_O_RDONLY);
if(fp==-1)
return NULL;
return _lseek(fp,0,SEEK_END);
//return NULL;
} int getfilesize03()
{
int fp;
fp=_open(__FILE__,_O_RDONLY);
if(fp==-1)
return NULL;
return _lseek(fp,0,SEEK_END);
//return NULL;
} int getfilesize04()
{
FILE *fp;
if((fp=fopen(__FILE__,"r"))==NULL)
return 0;
fseek(fp,0,SEEK_END);
return ftell(fp); //return NULL;
} int g
Ïà¹ØÎĵµ£º
×î½üÒòΪÑо¿Ò»¸ö¶«Î÷£¬²¢ÇÒÔںܾÃÒÔÇ°¾ÍÏë°ÑpythonºÃºÃ¿´¿´¡£ÕýºÃÂú×ãÎҵĺÃÆæÐÄ¡£ÎÒÿÌìÉÏ°à×öµÃÓÎÏ·¶¼ÊÇÓÃlua£¬Ò²ÊÇÒ»ÃźÜÇ¿´óµÄ½Å±¾ÓïÑÔ¡£¿ÉÄÜÎÒ¸üϲ»¶pythonµÄËõ½øÇø·ÖºÍÃæÏò¶ÔÏó°É¡£ ½ñÌìֻдһ¸ö¼òµ¥µÄÀý×Ó¡£Ò»¸ö¼òµ¥µÄpython½Å±¾£¬¾ÍÒ»¸öº¯Êý£¬ÓÃC/C++È¥µ÷Ó᣿ÉÄÜÕâÒ²ÊÇ×÷Ϊ³ÌÐòÀ´Ëµ×î¹ØÐĵÄÒ»¼þÊ¡£ËùÒÔÎÒµÄpytho ......
7.2.1 ½éÉÜgetchar()ºÍputchar()
Ç°ÃæµÄ¶àÊý³ÌÐòËùÊäÈëµÄÄÚÈݶ¼ÊÇÊý×Ö¡£ÎªÁËÁ·Ï°Ê¹ÓÃÆäËûµÄÐÎʽ£¬ÈÃÎÒÃÇÀ´¿´Ò»¸öÃæÏò×Ö·ûµÄÀý×Ó¡£
ÏÖÔÚÎÒÃǽ«½Ó´¥×¨ÃÅΪÃæÏò×Ö·ûI/O¶øÉè¼ÆµÄÒ»¶ÔCº¯Êý£ºgetchar()ºÍputchar()¡£
.
getchar()º¯ÊýûÓвÎÊý£¬Ëü·µ»ØÀ´×ÔÊäÈëÉ豸µÄÏÂÒ»¸ö×Ö·û¡£ÀýÈ磬ÏÂÃæµÄÓï¾ä¶ÁÈ¡ÏÂÒ»¸öÊäÈë×Ö·û²¢½«ËüµÄÖµ ......
Ò»¡¢ÇëÌîдBOOL , float, Ö¸Õë±äÁ¿ Óë“ÁãÖµ”±È½ÏµÄ if Óï¾ä¡££¨10·Ö£©
Ìáʾ£ºÕâÀï“ÁãÖµ”¿ÉÒÔÊÇ0, 0.0 , FALSE»òÕß“¿ÕÖ¸Õ딡£ÀýÈç int ±äÁ¿ n
Óë“ÁãÖµ”±È½ÏµÄ if Óï¾äΪ£º
if ( n == 0 )
if ( n != 0 )
ÒÔ´ËÀàÍÆ¡£
Çëд³ö BOOL flag Óë“ÁãÖµ”±È½ÏµÄ if ......
Ò»¡¢¼ò½é
µ÷ÊÔÆ÷(±ÈÈçÏóGDB)ÄÜÈÃÄã¹Û²ìÁíÒ»¸ö³ÌÐòÔÚÖ´ÐÐʱµÄÄÚ²¿»î¶¯£¬»ò³ÌÐò³ö´íʱ·¢ÉúÁËʲô¡£GDBÖ÷ÒªÄÜΪÄã×öËļþÊÂ(°üÀ¨ÎªÁËÍê³ÉÕâЩʶø¸½¼ÓµÄ¹¦ÄÜ)£¬°ïÖúÄãÕÒ³ö³ÌÐòÖеĴíÎó¡£
* ÔËÐÐÄãµÄ³ÌÐò£¬ÉèÖÃËùÓеÄÄÜÓ°Ïì³ÌÐòÔËÐеĶ«Î÷¡ ......
ÍøÓѹ۵ã:
(Ò»):
ÎÒÈÏΪºÜ¶àÈËûÓÐÀí½âlinus»òÕßmyanµÄÒâ˼£¬ÎÒ¾Ù¸öʵÀý¡£
ÎÒÃÇÏÖÔÚÒªÉè¼ÆÒ»Ì×ÍøÂ磿ͻ§¶ËÈí¼þ£¬ÎÒÃÇÒªÏÈ°ÑÐÒ鶨ºÃ£¬°Ñ½çÃæºÍºǫ́½»»¥Éè¼ÆÏëºÃ£¬°ÑÈÝ´íºÍ»Ö¸´ÏëºÃ£¬ÎÒÈÏΪÕâЩÊÇ×îÖØÒªµÄ£¬ÖÁÓÚ±àÂ룬ÓÃCÒ²¿ÉÒÔ±à³öÀ´£¬ÓÃC£«£«Ò²¿ÉÒÔ±à³öÀ´£¬ÉõÖÁÓÃJAVAÒ²Äܱà³öÀ´£¬¹Ø¼üÊÇÕû¸öÈí¼þµÄ¼Ü¹¹ÒªÇåÎú£¬Õ ......