易截截图软件、单文件、免安装、纯绿色、仅160KB

C MFC文本文件操作

FILE* pFile = fopen("1.txt","w");
fwrite("http://www.886997.com",1,strlen(http://www.886997.com),pFile);
fseek(pFile,0,SEEK_SET); //从文件的开始处覆盖写入
char cStr[100];
memset(cStr,0,sizeof(cStr));
fread(cStr,1,100,pFile);
char *pBuf;
fseek(pFile,0,SEEK_END);
int leng = ftell(pFile);
pBuf = new char[len+1];
rewind(pFile); //将指针移动到开头
fread(pBuf,1,len,pFile);
pBuf[len] = 0;
fclose(pFile);
CFile file("1.txt",CFile::modeCreate | CFile::modeWrite);
file.Write("sdfdfsd",strlen("sdfdfsd",)
char* pBuf;
DWORD dwLength;
dwLength = file.GetLength();
pBuf = new char[dwLength+1];
pBuf[dwLength]=0;
file.Read(pBuf,dwLength);
file.Close();
//读写INI文件
::WriteProfileString("key","keyName","keyValue");
CString str;
::GetProfileString("key","admin","lisi",str.GetBuffer(100),100);


相关文档:

C/C++语言编程修养2

21、goto语句的使用
—————————
 
N年前,软件开发的一代宗师——迪杰斯特拉(Dijkstra)说过:“goto statment is
harmful !!”,并建议取消goto语句。因为goto语句不利于程序代码的维护性。
 
这里我也强烈建议不要使用go ......

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 ......

c盘整理 Python脚本

能整理大部分无用文件
#!/usr/bin/python
#syscleaner.py
import os
import os.path
#delete files and directory recursively
def itedel(dir):
print('in dir :'+dir)
for doc in os.listdir(dir):
try:
if(os.path.isdir(doc)):
itedel(dir+'\\'+doc)
......

给C\C++程序员的建议

1,C++里几乎不需要用到宏,用const火enum定义明显的常量。用inline避免函数的额外开销,用template去刻画一族函数或者类型,用namespace去避免名字冲突。类也可以。
2,不要在你需要之前申明它,什么时候用什么时候申明(当年从C++转C的时候吃了老苦了);
3,不要用malloc(),new可以做的很好,对于realloc(),可以 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号