#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; }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.