Chinaunix首页 | 论坛 | 博客
  • 博客访问: 430247
  • 博文数量: 78
  • 博客积分: 1563
  • 博客等级: 上尉
  • 技术积分: 910
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-25 09:58
个人简介

爬虫

文章分类

全部博文(78)

文章存档

2020年(1)

2016年(1)

2015年(9)

2014年(1)

2013年(8)

2012年(6)

2011年(3)

2010年(4)

2008年(8)

2007年(13)

2006年(24)

我的朋友

分类: C/C++

2011-02-15 10:39:11

 VC2005 转换成 VC2003 收藏
今天看到一篇博文,说如何把VC2005工程转VC2003

其实用手工完成也很简单。文章最后将给出方法。先把博文转载如下。


今天在老外的网站上找到一个小工具 testConvert.exe, 能把VC2005的工程转换为VC2003,实在是爽,而且还给了源码。。哈哈
举个例子
D:\dx9\ 目录下 有 xxx.vcproj,是VC2005生成的
进入cmd控制台,
testConvert d:\dx9\***.vcproj
ok,就行了。

// code

#include "stdafx.h"
#include
#include
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    if(2 != argc){
        cout << " usage : theExe " << endl;
        return -1;
    }

    //read file to memory
    string strProject = argv[1];
    FILE* fp = NULL;
    if(NULL == (fp = fopen(strProject.c_str(), "r"))){
        cout << " cannot find the project" << endl;
        return -1;
    }

    string strText;

    while(!feof(fp)){
        strText += fgetc(fp);
    }

    fclose(fp);

    //replace it
    CAtlRegExp<> oRegExp;
    oRegExp.Parse("Version="[7-9].[0-9]0"");

    CAtlREMatchContext<> oMatchContext;
    if (!oRegExp.Match(strText.c_str(), &oMatchContext))
    {
        cout << " invalidate format" << endl;
        return -1;
    }

    string strNewText = strText.substr(0, strText.size() - lstrlen(oMatchContext.m_Match.szStart)) + "Version="7.00"" +
        strText.substr(strText.size() - lstrlen(oMatchContext.m_Match.szEnd), -1);
   
    //backup
    string strBackProject = strProject + "_old";
    CopyFile(strProject.c_str(), strBackProject.c_str(),FALSE);
   
    //dump it to disk
    if(NULL == (fp = fopen(strProject.c_str(), "r+"))){
        cout << " cannot find the project" << endl;
        return -1;
    }

    fwrite(strNewText.c_str(),1,strNewText.size() - 1, fp);

    fclose(fp);

    return 0;
}
我经常使用的手工转换方法。
其实只要修改两个文件就可以了。
1是.sln,记事本打开项目的sln文件,修改Format Version 9.00 为 Format Version 8.00
然后是.vcproj文件,修改Version="8.00"为Version="7.10"
这样就可以用VC2003打开VC2005的工程项目了。


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/b2b160/archive/2009/03/24/4019216.aspx

阅读(1647) | 评论(1) | 转发(0) |
0

上一篇:php dom的操作来读取xml

下一篇:apt-get install

给主人留下些什么吧!~~

chinaunix网友2011-03-06 16:17:20

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com