#include <string> #include <iostream> #include <fstream> #include <FileGDBAPI.h> using namespace std; using namespace FileGDBAPI; int main() { // Open the geodatabase. fgdbError hr; wstring errorText; Geodatabase geodatabase; if ((hr = OpenGeodatabase(L"C:/FileGDB_API_Issues/Montgomery.gdb", geodatabase)) != S_OK) { wcout << "An error occurred while opening the geodatabase." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } Table table; if ((hr = geodatabase.OpenTable(L"\\Landbase\\Blocks", table)) != S_OK) { wcout << "An error occurred while opening the table." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } string tableDef; if ((hr = table.GetDefinition(tableDef)) != S_OK) { wcout << "An error occurred while opening the table." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } ofstream myfile; myfile.open("../Blocks.xml", ios::out); myfile << tableDef; tableDef.clear(); myfile.close(); // Close the table if ((hr = geodatabase.CloseTable(table)) != S_OK) { wcout << "An error occurred while closing Cities." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } // Close the geodatabase if ((hr = CloseGeodatabase(geodatabase)) != S_OK) { wcout << "An error occurred while closing the geodatabase." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } return 0; }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.