Message 1 of 8

Not applicable
03-22-2015
05:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
typedef std::vector<AcApDocument*> vecApDoc; vecApDoc getAllOpenDoc() { vecApDoc rec; AcApDocumentIterator * it = acDocManager->newAcApDocumentIterator(); for(;!it->done();it->step()) { rec.push_back(it->document()); } delete it; it = NULL; return rec; }
//find no active doc,delete it void close1Doc_and_delete() { vecApDoc docs = getAllOpenDoc(); for (int d = 0; d < docs.size(); d++) { AcApDocument* p = docs[d]; if(p == acDocManager->curDocument()) continue; acDocManager->closeDocument(p); //(1) //delete dwg file int res = remove(p->fileName());// !!!Failed!!! if(res != 0 ){//remove() failed vecApDoc docOpen= getAllOpenDoc(); for (int f = 0; f < docOpen.size(); f++) { //following line assert fail!!! //Prove that (1) closeDocument() code not really work! ASSERT(strcmp(docOpen[f]->fileName(),p->fileName()) != 0); } } break; } } Note: I'm sure all the opened files are not modified.And Now opened with write right.
Located in local disk and normal place.
How can I really closeDocument() immediately or synchronously.
As far as I known,after the acDocManager->closeDocument(p) that file is not write-access.
any hint? any way to accomplish it!
Solved! Go to Solution.