2012年9月19日

【C/C++】关于编译错误 "error C2146: syntax error : missing ';' before identifier 'xxx'"

摘要: 今天帮同学解决了一个问题,之前其实也遇到过,现在总结一下。问题大概是这样的,假设有如下代码:#include <tchar.h>DWORD g_count = 0;int _tmain(int argc, _TCHAR* argv[]){ return 0;}使用VS编译会报如下错误:1>f:\testproj\consoletest_vs2005\test\test.cpp(3) : error C2146: syntax error : missing ';' before identifier 'g_count'1>f:\testp 阅读全文

posted @ 2012-09-19 14:53 jeJee 阅读(13777) 评论(0) 推荐(0) 编辑

【python】只对文件open,不close的后果

摘要: 这个问题的主要目的是研究当程序中没有显示close掉已经open的文件,那么这个文件会在什么时候被close掉?已经知道在C++中,打开的文件句柄没有被close掉的话,那这个句柄只会在程序退出时才会被释放掉,那么在python是否也是这样的呢?接下来做个实验:1.有如下代码:import osclass OpenFileTest: def openfile(self, filePath): handle = open(filePath, 'wb') passif __name__ == "__main__": t = OpenFileTest(... 阅读全文

posted @ 2012-09-19 12:01 jeJee 阅读(9433) 评论(0) 推荐(0) 编辑

导航