最简单的做法,直接使用notepad:
把你需要的输出,存到一个临时txt文件中去(可以使用系统的temp目录),假设你存的是c:\windows\temp\output.txt,使用WinExec("notepad.exe c:\\windows\\temp\\output.txt"); 就可以了.
把你需要的输出,存到一个临时txt文件中去(可以使用系统的temp目录),假设你存的是c:\windows\temp\output.txt,使用WinExec("notepad.exe c:\\windows\\temp\\output.txt"); 就可以了.
GetTempPath(sizeof(szTempPath) / sizeof(TCHAR), szTempPath);
CString strFile = szTempPath + _T("\\output.txt");
CFile fileOutput(strFile, CFile::modeCreate | CFile::modeReadWrite);
fileOutput.Write(......);
fileOutput.Write(......);
......CString strCmd;
strCmd = _T("notepad.exe ");
strCmd += strFile;
WinExec(strCmd); 还有,一般这个临时文件不用删除,因为,首先,它位于系统的temp目录;其次,下次你调用同样的code时(CFile fileOutput(strFile, CFile::modeCreate | CFile::modeReadWrite);),会把原来的内容清空。当然,你想在合适的时候把它删除,那也没问题。