1.C语言函数fopen(),式例代码: //author:firehood //data: 2011-5-19 #include <stdio.h> #include <tchar.h> int _tmain(int argc, _TCHAR* argv[]) { // 创建或打开二进制文件,并以追加方式打开 FILE *pFile=_tfopen(_T("//NAND2//FileLog1.txt"), _T("wab+")); if(pFile) { fwprintf(pFile, _T("%s/n"), _T("test1")); fwprintf(pFile, _T("%s/n"), _T("test2")); fwprintf(pFile, _T("%s/n"), _T("test3")); fclose(pFile); } // 读文件 pFile=_tfopen(_T("//NAND2//FileLog1.txt"), _T("rb")); TCHAR str[20]; if(pFile) { while(_ftscanf(pFile,_T("%s/n"),str)!=EOF) { _tprintf(_T("%s/n"),str); } fclose(pFile); } return 0; } 2.C++ fstream,式例代码: //author:firehood //data: 2011-5-19 #include <tchar.h> #i