69,336
社区成员
发帖
与我相关
我的任务
分享
int main(int argc, char* argv[])
{
bool bRemoveAsterisk=false;
bool bRemoveSlash=false;
bool bRemoveBlankLine=false;
bool bReplaceTab=false;
String str,file1,file2;
int n;
int iErrorCode=0;
for(int i=1;i<argc;i++)
{
str = argv[i];
if(str=="//") bRemoveSlash=true;
else if(str=="/*") bRemoveAsterisk=true;
else if(str=="/b") bRemoveBlankLine=true;
else if(str.SubString(1,2)=="/t")
{
if(str=="/t")
{
cout<<"对C语言程序源文件进行处理"<<endl;
cout<<endl;
cout<<"CommRemove [/b] [/*] [//] [/t<n>] <file1> <file2>"<<endl;
cout<<endl;
cout<<" <file1> 需要处理的源文件"<<endl;
cout<<" <file2> 处理后的结果文件"<<endl;
cout<<endl;
cout<<" [/t<n>] 将源文件中的TAB字符替换为空格,n为替换空格的个数"<<endl;
cout<<" 其中的<n>必须指定一个数值"<<endl;
iErrorCode = 3;
}
String ns = str.SubString(3,255);
bReplaceTab=true;
n = atoi(ns.c_str());
}
else if(file1.Length()==0) file1 = str;
else file2 = str;
}
if(iErrorCode!=0) return iErrorCode;