This is in my open source project for lispers, there is also a few other goodies in here, I will post this in the "Show your stuff" area in a while
Arx code.
static int ads_saveas2004(void)
{
Acad::ErrorStatus es;
struct resbuf *pArgs =acedGetArgs () ;
if (pArgs == NULL || pArgs->restype != RTSTR )
return RSERR;
if (pArgs->restype != RTSTR )
return RSERR;
CString infile = pArgs->resval.rstring;
if ((pArgs = pArgs->rbnext) == NULL || pArgs->restype != RTSTR )
return RSERR;
CString outfile = pArgs->resval.rstring;
std::auto_ptr<AcDbDatabase> pDb(new AcDbDatabase(Adesk::kFalse));
es = pDb->readDwgFile(infile);
if(es != Acad::eOk)
return es;
es = acdbSaveAs2004(pDb.get(),outfile);
if(es != Acad::eOk)
return es;
acedRetT();
return (RSRSLT) ;
}
static int ads_saveas2000(void)
{
Acad::ErrorStatus es;
struct resbuf *pArgs =acedGetArgs () ;
if (pArgs == NULL || pArgs->restype != RTSTR )
return RSERR;
if (pArgs->restype != RTSTR )
return RSERR;
CString infile = pArgs->resval.rstring;
if ((pArgs = pArgs->rbnext) == NULL || pArgs->restype != RTSTR )
return RSERR;
CString outfile = pArgs->resval.rstring;
std::auto_ptr<AcDbDatabase> pDb(new AcDbDatabase(Adesk::kFalse));
es = pDb->readDwgFile(infile);
if(es != Acad::eOk)
return es;
es = acdbSaveAs2000(pDb.get(),outfile);
if(es != Acad::eOk)
return es;
acedRetT();
return (RSRSLT) ;
}