The acedFindFile() function enables an application to search for a file of a particular name. The application can specify the directory to search, or it can use the current AutoCAD library path.
In the following sample code fragment, acedFindFile() searches for the requested file name according to the AutoCAD library path.
char *refname = "refc.dwg"; char fullpath[100]; . . . if (acedFindFile(refname, fullpath) != RTNORM) { acutPrintf("Could not find file %s.\n", refname); return BAD;
If the call to acedFindFile() is successful, the fullpath argument is set to a fully qualified path name string, such as the following:
/home/work/ref/refc.dwg
You can also prompt users to enter a file name by means of the standard AutoCAD file dialog box. To display the file dialog box, call acedGetFileD().
The following sample code fragment uses the file dialog box to prompt users for the name of an ObjectARX application.
struct resbuf *result; int rc, flags; if (result = acutNewRb(RTSTR) == NULL) { acdbFail("Unable to allocate buffer\n"); return BAD; } result->resval.rstring=NULL; flags = 2; // Disable the "Type it" button. rc = acedGetFileD("Get ObjectARX Application", // Title "/home/work/ref/myapp", // Default pathname NULL, // The default extension: NULL means "*". flags, // The control flags result); // The path selected by the user. if (rc == RTNORM) rc = acedArxLoad(result->resval.rstring);