1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
return 1;
}
CString strFile=argv[1];
CString strNewFile=strFile+"hh";
int nMode=CFile::modeCreate | CFile::modeWrite | CFile::typeText;
CString strLine,str;
int n=3000;
int nPos;
TRY
{
CStdioFile File(strFile, CFile::modeRead | CFile::typeBinary);
CStdioFile FileDup(strNewFile, nMode );
while(File.ReadString(strLine))
{
strLine.TrimLeft();
strLine.TrimRight();
if(strLine.Find("#define IDC_")==-1) continue;
nPos=strLine.ReverseFind(' ');
strLine=strLine.Left(nPos+1);
str.Format("%4d",n);
n++;
strLine+=str;
FileDup.WriteString(strLine+"\n");
}
}
CATCH( CFileException, e )
{
nRetCode=-1;
}
END_CATCH
return nRetCode;
} |
Partager