How to detect if a DWG file is already opened by another user using C++?

By Gopinath Taget

You can check if a DWG file is already opened or not, using a file mode for "append." For example, the following code demonstrates the usage:

ACHAR fileName[] = L"myDrawing.dwg";

void fileInUse()

{

ofstream fp(fileName, ios::app) ;

 if(!fp) {

  acutPrintf(L"%s is IN USE.\n", fileName);

}

 else {

  acutPrintf(L"%s is NOT in use.\n", fileName);

  fp.close();

}

}


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading