2021年2月6日星期六

[SOLVED]Unhandled exception at 0x78F90870 (ucrtbased.dll) in Metrics_Alpha.exe: 0xC0000005: Access violation reading location 0x00000000

Trying to work with Excel files using C++ (as a pretty "less-than-professional" programmer). It seems I brought all the libraries in correctly, etc; if I need to post those and included SDKs, I can. However, I'm running into the above error.

Here is where I am working with the Excel file directly:

void themSheets() {      cout << endl << endl;      try {          Excel::_ApplicationPtr pXL;          pXL->Workbooks->Open(L"C:/Users/Person/source/repos/Metrics_Alpha/Metrics_Alpha/poooopy.xlsx");          pXL->PutVisible(0, FALSE);            Excel::_WorksheetPtr pSheet = pXL->ActiveSheet;          pSheet->Name = L"Sheet1";          Excel::RangePtr pRange = pSheet->Cells;            pRange->Item[1][1] = 5.21;          double apples = pRange->Item[1][1];          cout << endl << apples;          pXL->Workbooks->Close();      }      catch (_com_error & error) {          cout << error.Description() << endl;      }  }  

And here is where the exception happens:

    _NODISCARD static _CONSTEXPR17 size_t length(_In_z_ const _Elem* const _First) noexcept /* strengthened */ {      // find length of null-terminated string  #if _HAS_CXX17  #ifdef __cpp_char8_t          if constexpr (is_same_v<_Elem, char8_t>) {  #if _HAS_U8_INTRINSICS              return __builtin_u8strlen(_First);  #else // ^^^ use u8 intrinsics / no u8 intrinsics vvv              return _Primary_char_traits::length(_First);  

没有评论:

发表评论