Unhandled exception at 0x000007FEDF2C9120 (gdal202.dll) in GdalTest.exe: 0xC0000005: Access violation reading...












1















I try using CreateCopy(), it seem in thrown me an exception when i run the program




Unhandled exception at 0x000007FEDF2C9120 (gdal202.dll) in GdalTest.exe: 0xC0000005: Access violation reading location 0x0000000000000058.




enter image description here



It will display this output on the console:



enter image description here



I try debug on the exception occurs, on the call stack it will go to the new tab then display no symbol loaded



enter image description here



I hope someone can explain to me what file not be loaded and if the console can view raster map it is will throw an error or exception ?
Below is my code if someone want to copy and make reference it just i have issues on "Using CreateCopy()" part.



Thank you and best regards,



// GdalTest.cpp : Defines the entry point for the console application.
//



#include "cpl_conv.h" // for CPLMalloc()
#include "stdafx.h"
#include "gdal.h"
#include <stdlib.h>
#include <stdio.h>
#include "iostream"
#include "cpl_string.h"
#include "gdal_priv.h"




class GDALMajorObject;
class GDALDataset;
class GDALRasterBand;
class GDALDriver;
class GDALRasterAttributeTable;
class GDALProxyDataset;
class GDALProxyRasterBand;
class GDALAsyncReader;




int main(int argc,char* argv)
{

///*/*/*/*/*/*/*/*/*/*Getting Dataset Information*/*/*/*/*/*/*/*/*/*/

GDALDataset *poDataset;


//GDALDatasetH *poDatasetH;
const char* Raster = new char[256];
double adfGeoTransform[6];


GDALAllRegister();

Raster = "C:\Users\User\Desktop\DSI REFERENCE\Map Data\Raster\4257.tif";

poDataset = (GDALDataset *) GDALOpen(Raster, GA_ReadOnly )CPL_WARN_UNUSED_RESULT;
//poDataset = (GDALDataset *) GDALOpen(Raster, GA_ReadOnly );

if( poDataset == NULL )
{
printf("Not found");
}
else
{
printf( "Driver: %s/%sn",
poDataset->GetDriver()->GetDescription(),
poDataset->GetDriver()->GetMetadataItem( GDAL_DMD_LONGNAME ) );

printf( "Size is %dx%dx%dn",
poDataset->GetRasterXSize(), poDataset->GetRasterYSize(),
poDataset->GetRasterCount() );

if( poDataset->GetProjectionRef() != NULL )
printf( "Projection is `%s'n", poDataset->GetProjectionRef() );

if( poDataset->GetGeoTransform( adfGeoTransform ) == CE_None )
{
printf( "Origin = (%.6f,%.6f)n",
adfGeoTransform[0], adfGeoTransform[3] );
printf( "Pixel Size = (%.6f,%.6f)n",
adfGeoTransform[1], adfGeoTransform[5] );

}

}

///*/*/*/*/*/*/*/*/*/* Fetching a Raster Band*/*/*/*/*/*/*/*/*/*/

GDALRasterBand *poBand;
int nBlockXSize, nBlockYSize;
int bGotMin, bGotMax;
double adfMinMax[2];

poBand = poDataset->GetRasterBand( 1 );
poBand->GetBlockSize( &nBlockXSize, &nBlockYSize );

printf( "Block=%dx%d Type=%s, ColorInterp=%sn", nBlockXSize, nBlockYSize,GDALGetDataTypeName(poBand->GetRasterDataType()),
GDALGetColorInterpretationName( poBand->GetColorInterpretation()) );

adfMinMax[0] = poBand->GetMinimum( &bGotMin );
adfMinMax[1] = poBand->GetMaximum( &bGotMax );

if( ! (bGotMin && bGotMax) )
GDALComputeRasterMinMax((GDALRasterBandH)poBand, TRUE, adfMinMax);

printf( "Min=%.3fd, Max=%.3fn", adfMinMax[0], adfMinMax[1] );

if( poBand->GetOverviewCount() > 0 )
printf( "Band has %d overviews.n", poBand->GetOverviewCount() );

if( poBand->GetColorTable() != NULL )
printf( "Band has a color table with %d entries.n",
poBand->GetColorTable()->GetColorEntryCount() );

// make it 256 bytes for a string length of 255 plus null () terminator

///*/*/*/*/*/*/*/*/*/*/*Reading Raster Data*/*/*/*/*/*/*/*/*/*/*/

float *pafScanline;
int nXSize = poBand->GetXSize();
pafScanline = (float *) CPLMalloc(sizeof(float)*nXSize);
poBand->RasterIO( GF_Read, 0, 0, nXSize, 1,pafScanline, nXSize, 1, GDT_Float32,0, 0 );

///*/*/*/*/*/*/*/*/*/*/*Techniques for Creating Files (determine whether it supports Create() and/or CreateCopy().) */*/*/*/*/*/*/*/*/*/*/

const char *pszFormat = "GTiff";
GDALDriver *poDriver;
char **papszMetadata;
poDriver = GetGDALDriverManager()->GetDriverByName(pszFormat);

if( poDriver == NULL )
exit( 1 );

papszMetadata = poDriver->GetMetadata();
if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATE, FALSE ) )
printf( "Driver %s supports Create() method.n", pszFormat );

if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATECOPY, FALSE ) )
printf( "Driver %s supports CreateCopy() method.n", pszFormat );

///*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*Using CreateCopy()*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/

const char*pszDstFilename= new char[256];

GDALDataset *poSrcDS =(GDALDataset *) GDALOpen( pszDstFilename, GA_ReadOnly );
GDALDataset *poDstDS;
poDstDS = poDriver->CreateCopy( pszDstFilename, poSrcDS, FALSE,NULL, NULL, NULL );
/* Once we're done, close properly the dataset */
if( poDstDS != NULL )
GDALClose( (GDALDatasetH) poDstDS );
GDALClose( (GDALDatasetH) poSrcDS );

std::cin.get();

//delete Raster;// release the memory VERY IMPORTANT


}









share|improve this question



























    1















    I try using CreateCopy(), it seem in thrown me an exception when i run the program




    Unhandled exception at 0x000007FEDF2C9120 (gdal202.dll) in GdalTest.exe: 0xC0000005: Access violation reading location 0x0000000000000058.




    enter image description here



    It will display this output on the console:



    enter image description here



    I try debug on the exception occurs, on the call stack it will go to the new tab then display no symbol loaded



    enter image description here



    I hope someone can explain to me what file not be loaded and if the console can view raster map it is will throw an error or exception ?
    Below is my code if someone want to copy and make reference it just i have issues on "Using CreateCopy()" part.



    Thank you and best regards,



    // GdalTest.cpp : Defines the entry point for the console application.
    //



    #include "cpl_conv.h" // for CPLMalloc()
    #include "stdafx.h"
    #include "gdal.h"
    #include <stdlib.h>
    #include <stdio.h>
    #include "iostream"
    #include "cpl_string.h"
    #include "gdal_priv.h"




    class GDALMajorObject;
    class GDALDataset;
    class GDALRasterBand;
    class GDALDriver;
    class GDALRasterAttributeTable;
    class GDALProxyDataset;
    class GDALProxyRasterBand;
    class GDALAsyncReader;




    int main(int argc,char* argv)
    {

    ///*/*/*/*/*/*/*/*/*/*Getting Dataset Information*/*/*/*/*/*/*/*/*/*/

    GDALDataset *poDataset;


    //GDALDatasetH *poDatasetH;
    const char* Raster = new char[256];
    double adfGeoTransform[6];


    GDALAllRegister();

    Raster = "C:\Users\User\Desktop\DSI REFERENCE\Map Data\Raster\4257.tif";

    poDataset = (GDALDataset *) GDALOpen(Raster, GA_ReadOnly )CPL_WARN_UNUSED_RESULT;
    //poDataset = (GDALDataset *) GDALOpen(Raster, GA_ReadOnly );

    if( poDataset == NULL )
    {
    printf("Not found");
    }
    else
    {
    printf( "Driver: %s/%sn",
    poDataset->GetDriver()->GetDescription(),
    poDataset->GetDriver()->GetMetadataItem( GDAL_DMD_LONGNAME ) );

    printf( "Size is %dx%dx%dn",
    poDataset->GetRasterXSize(), poDataset->GetRasterYSize(),
    poDataset->GetRasterCount() );

    if( poDataset->GetProjectionRef() != NULL )
    printf( "Projection is `%s'n", poDataset->GetProjectionRef() );

    if( poDataset->GetGeoTransform( adfGeoTransform ) == CE_None )
    {
    printf( "Origin = (%.6f,%.6f)n",
    adfGeoTransform[0], adfGeoTransform[3] );
    printf( "Pixel Size = (%.6f,%.6f)n",
    adfGeoTransform[1], adfGeoTransform[5] );

    }

    }

    ///*/*/*/*/*/*/*/*/*/* Fetching a Raster Band*/*/*/*/*/*/*/*/*/*/

    GDALRasterBand *poBand;
    int nBlockXSize, nBlockYSize;
    int bGotMin, bGotMax;
    double adfMinMax[2];

    poBand = poDataset->GetRasterBand( 1 );
    poBand->GetBlockSize( &nBlockXSize, &nBlockYSize );

    printf( "Block=%dx%d Type=%s, ColorInterp=%sn", nBlockXSize, nBlockYSize,GDALGetDataTypeName(poBand->GetRasterDataType()),
    GDALGetColorInterpretationName( poBand->GetColorInterpretation()) );

    adfMinMax[0] = poBand->GetMinimum( &bGotMin );
    adfMinMax[1] = poBand->GetMaximum( &bGotMax );

    if( ! (bGotMin && bGotMax) )
    GDALComputeRasterMinMax((GDALRasterBandH)poBand, TRUE, adfMinMax);

    printf( "Min=%.3fd, Max=%.3fn", adfMinMax[0], adfMinMax[1] );

    if( poBand->GetOverviewCount() > 0 )
    printf( "Band has %d overviews.n", poBand->GetOverviewCount() );

    if( poBand->GetColorTable() != NULL )
    printf( "Band has a color table with %d entries.n",
    poBand->GetColorTable()->GetColorEntryCount() );

    // make it 256 bytes for a string length of 255 plus null () terminator

    ///*/*/*/*/*/*/*/*/*/*/*Reading Raster Data*/*/*/*/*/*/*/*/*/*/*/

    float *pafScanline;
    int nXSize = poBand->GetXSize();
    pafScanline = (float *) CPLMalloc(sizeof(float)*nXSize);
    poBand->RasterIO( GF_Read, 0, 0, nXSize, 1,pafScanline, nXSize, 1, GDT_Float32,0, 0 );

    ///*/*/*/*/*/*/*/*/*/*/*Techniques for Creating Files (determine whether it supports Create() and/or CreateCopy().) */*/*/*/*/*/*/*/*/*/*/

    const char *pszFormat = "GTiff";
    GDALDriver *poDriver;
    char **papszMetadata;
    poDriver = GetGDALDriverManager()->GetDriverByName(pszFormat);

    if( poDriver == NULL )
    exit( 1 );

    papszMetadata = poDriver->GetMetadata();
    if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATE, FALSE ) )
    printf( "Driver %s supports Create() method.n", pszFormat );

    if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATECOPY, FALSE ) )
    printf( "Driver %s supports CreateCopy() method.n", pszFormat );

    ///*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*Using CreateCopy()*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/

    const char*pszDstFilename= new char[256];

    GDALDataset *poSrcDS =(GDALDataset *) GDALOpen( pszDstFilename, GA_ReadOnly );
    GDALDataset *poDstDS;
    poDstDS = poDriver->CreateCopy( pszDstFilename, poSrcDS, FALSE,NULL, NULL, NULL );
    /* Once we're done, close properly the dataset */
    if( poDstDS != NULL )
    GDALClose( (GDALDatasetH) poDstDS );
    GDALClose( (GDALDatasetH) poSrcDS );

    std::cin.get();

    //delete Raster;// release the memory VERY IMPORTANT


    }









    share|improve this question

























      1












      1








      1








      I try using CreateCopy(), it seem in thrown me an exception when i run the program




      Unhandled exception at 0x000007FEDF2C9120 (gdal202.dll) in GdalTest.exe: 0xC0000005: Access violation reading location 0x0000000000000058.




      enter image description here



      It will display this output on the console:



      enter image description here



      I try debug on the exception occurs, on the call stack it will go to the new tab then display no symbol loaded



      enter image description here



      I hope someone can explain to me what file not be loaded and if the console can view raster map it is will throw an error or exception ?
      Below is my code if someone want to copy and make reference it just i have issues on "Using CreateCopy()" part.



      Thank you and best regards,



      // GdalTest.cpp : Defines the entry point for the console application.
      //



      #include "cpl_conv.h" // for CPLMalloc()
      #include "stdafx.h"
      #include "gdal.h"
      #include <stdlib.h>
      #include <stdio.h>
      #include "iostream"
      #include "cpl_string.h"
      #include "gdal_priv.h"




      class GDALMajorObject;
      class GDALDataset;
      class GDALRasterBand;
      class GDALDriver;
      class GDALRasterAttributeTable;
      class GDALProxyDataset;
      class GDALProxyRasterBand;
      class GDALAsyncReader;




      int main(int argc,char* argv)
      {

      ///*/*/*/*/*/*/*/*/*/*Getting Dataset Information*/*/*/*/*/*/*/*/*/*/

      GDALDataset *poDataset;


      //GDALDatasetH *poDatasetH;
      const char* Raster = new char[256];
      double adfGeoTransform[6];


      GDALAllRegister();

      Raster = "C:\Users\User\Desktop\DSI REFERENCE\Map Data\Raster\4257.tif";

      poDataset = (GDALDataset *) GDALOpen(Raster, GA_ReadOnly )CPL_WARN_UNUSED_RESULT;
      //poDataset = (GDALDataset *) GDALOpen(Raster, GA_ReadOnly );

      if( poDataset == NULL )
      {
      printf("Not found");
      }
      else
      {
      printf( "Driver: %s/%sn",
      poDataset->GetDriver()->GetDescription(),
      poDataset->GetDriver()->GetMetadataItem( GDAL_DMD_LONGNAME ) );

      printf( "Size is %dx%dx%dn",
      poDataset->GetRasterXSize(), poDataset->GetRasterYSize(),
      poDataset->GetRasterCount() );

      if( poDataset->GetProjectionRef() != NULL )
      printf( "Projection is `%s'n", poDataset->GetProjectionRef() );

      if( poDataset->GetGeoTransform( adfGeoTransform ) == CE_None )
      {
      printf( "Origin = (%.6f,%.6f)n",
      adfGeoTransform[0], adfGeoTransform[3] );
      printf( "Pixel Size = (%.6f,%.6f)n",
      adfGeoTransform[1], adfGeoTransform[5] );

      }

      }

      ///*/*/*/*/*/*/*/*/*/* Fetching a Raster Band*/*/*/*/*/*/*/*/*/*/

      GDALRasterBand *poBand;
      int nBlockXSize, nBlockYSize;
      int bGotMin, bGotMax;
      double adfMinMax[2];

      poBand = poDataset->GetRasterBand( 1 );
      poBand->GetBlockSize( &nBlockXSize, &nBlockYSize );

      printf( "Block=%dx%d Type=%s, ColorInterp=%sn", nBlockXSize, nBlockYSize,GDALGetDataTypeName(poBand->GetRasterDataType()),
      GDALGetColorInterpretationName( poBand->GetColorInterpretation()) );

      adfMinMax[0] = poBand->GetMinimum( &bGotMin );
      adfMinMax[1] = poBand->GetMaximum( &bGotMax );

      if( ! (bGotMin && bGotMax) )
      GDALComputeRasterMinMax((GDALRasterBandH)poBand, TRUE, adfMinMax);

      printf( "Min=%.3fd, Max=%.3fn", adfMinMax[0], adfMinMax[1] );

      if( poBand->GetOverviewCount() > 0 )
      printf( "Band has %d overviews.n", poBand->GetOverviewCount() );

      if( poBand->GetColorTable() != NULL )
      printf( "Band has a color table with %d entries.n",
      poBand->GetColorTable()->GetColorEntryCount() );

      // make it 256 bytes for a string length of 255 plus null () terminator

      ///*/*/*/*/*/*/*/*/*/*/*Reading Raster Data*/*/*/*/*/*/*/*/*/*/*/

      float *pafScanline;
      int nXSize = poBand->GetXSize();
      pafScanline = (float *) CPLMalloc(sizeof(float)*nXSize);
      poBand->RasterIO( GF_Read, 0, 0, nXSize, 1,pafScanline, nXSize, 1, GDT_Float32,0, 0 );

      ///*/*/*/*/*/*/*/*/*/*/*Techniques for Creating Files (determine whether it supports Create() and/or CreateCopy().) */*/*/*/*/*/*/*/*/*/*/

      const char *pszFormat = "GTiff";
      GDALDriver *poDriver;
      char **papszMetadata;
      poDriver = GetGDALDriverManager()->GetDriverByName(pszFormat);

      if( poDriver == NULL )
      exit( 1 );

      papszMetadata = poDriver->GetMetadata();
      if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATE, FALSE ) )
      printf( "Driver %s supports Create() method.n", pszFormat );

      if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATECOPY, FALSE ) )
      printf( "Driver %s supports CreateCopy() method.n", pszFormat );

      ///*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*Using CreateCopy()*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/

      const char*pszDstFilename= new char[256];

      GDALDataset *poSrcDS =(GDALDataset *) GDALOpen( pszDstFilename, GA_ReadOnly );
      GDALDataset *poDstDS;
      poDstDS = poDriver->CreateCopy( pszDstFilename, poSrcDS, FALSE,NULL, NULL, NULL );
      /* Once we're done, close properly the dataset */
      if( poDstDS != NULL )
      GDALClose( (GDALDatasetH) poDstDS );
      GDALClose( (GDALDatasetH) poSrcDS );

      std::cin.get();

      //delete Raster;// release the memory VERY IMPORTANT


      }









      share|improve this question














      I try using CreateCopy(), it seem in thrown me an exception when i run the program




      Unhandled exception at 0x000007FEDF2C9120 (gdal202.dll) in GdalTest.exe: 0xC0000005: Access violation reading location 0x0000000000000058.




      enter image description here



      It will display this output on the console:



      enter image description here



      I try debug on the exception occurs, on the call stack it will go to the new tab then display no symbol loaded



      enter image description here



      I hope someone can explain to me what file not be loaded and if the console can view raster map it is will throw an error or exception ?
      Below is my code if someone want to copy and make reference it just i have issues on "Using CreateCopy()" part.



      Thank you and best regards,



      // GdalTest.cpp : Defines the entry point for the console application.
      //



      #include "cpl_conv.h" // for CPLMalloc()
      #include "stdafx.h"
      #include "gdal.h"
      #include <stdlib.h>
      #include <stdio.h>
      #include "iostream"
      #include "cpl_string.h"
      #include "gdal_priv.h"




      class GDALMajorObject;
      class GDALDataset;
      class GDALRasterBand;
      class GDALDriver;
      class GDALRasterAttributeTable;
      class GDALProxyDataset;
      class GDALProxyRasterBand;
      class GDALAsyncReader;




      int main(int argc,char* argv)
      {

      ///*/*/*/*/*/*/*/*/*/*Getting Dataset Information*/*/*/*/*/*/*/*/*/*/

      GDALDataset *poDataset;


      //GDALDatasetH *poDatasetH;
      const char* Raster = new char[256];
      double adfGeoTransform[6];


      GDALAllRegister();

      Raster = "C:\Users\User\Desktop\DSI REFERENCE\Map Data\Raster\4257.tif";

      poDataset = (GDALDataset *) GDALOpen(Raster, GA_ReadOnly )CPL_WARN_UNUSED_RESULT;
      //poDataset = (GDALDataset *) GDALOpen(Raster, GA_ReadOnly );

      if( poDataset == NULL )
      {
      printf("Not found");
      }
      else
      {
      printf( "Driver: %s/%sn",
      poDataset->GetDriver()->GetDescription(),
      poDataset->GetDriver()->GetMetadataItem( GDAL_DMD_LONGNAME ) );

      printf( "Size is %dx%dx%dn",
      poDataset->GetRasterXSize(), poDataset->GetRasterYSize(),
      poDataset->GetRasterCount() );

      if( poDataset->GetProjectionRef() != NULL )
      printf( "Projection is `%s'n", poDataset->GetProjectionRef() );

      if( poDataset->GetGeoTransform( adfGeoTransform ) == CE_None )
      {
      printf( "Origin = (%.6f,%.6f)n",
      adfGeoTransform[0], adfGeoTransform[3] );
      printf( "Pixel Size = (%.6f,%.6f)n",
      adfGeoTransform[1], adfGeoTransform[5] );

      }

      }

      ///*/*/*/*/*/*/*/*/*/* Fetching a Raster Band*/*/*/*/*/*/*/*/*/*/

      GDALRasterBand *poBand;
      int nBlockXSize, nBlockYSize;
      int bGotMin, bGotMax;
      double adfMinMax[2];

      poBand = poDataset->GetRasterBand( 1 );
      poBand->GetBlockSize( &nBlockXSize, &nBlockYSize );

      printf( "Block=%dx%d Type=%s, ColorInterp=%sn", nBlockXSize, nBlockYSize,GDALGetDataTypeName(poBand->GetRasterDataType()),
      GDALGetColorInterpretationName( poBand->GetColorInterpretation()) );

      adfMinMax[0] = poBand->GetMinimum( &bGotMin );
      adfMinMax[1] = poBand->GetMaximum( &bGotMax );

      if( ! (bGotMin && bGotMax) )
      GDALComputeRasterMinMax((GDALRasterBandH)poBand, TRUE, adfMinMax);

      printf( "Min=%.3fd, Max=%.3fn", adfMinMax[0], adfMinMax[1] );

      if( poBand->GetOverviewCount() > 0 )
      printf( "Band has %d overviews.n", poBand->GetOverviewCount() );

      if( poBand->GetColorTable() != NULL )
      printf( "Band has a color table with %d entries.n",
      poBand->GetColorTable()->GetColorEntryCount() );

      // make it 256 bytes for a string length of 255 plus null () terminator

      ///*/*/*/*/*/*/*/*/*/*/*Reading Raster Data*/*/*/*/*/*/*/*/*/*/*/

      float *pafScanline;
      int nXSize = poBand->GetXSize();
      pafScanline = (float *) CPLMalloc(sizeof(float)*nXSize);
      poBand->RasterIO( GF_Read, 0, 0, nXSize, 1,pafScanline, nXSize, 1, GDT_Float32,0, 0 );

      ///*/*/*/*/*/*/*/*/*/*/*Techniques for Creating Files (determine whether it supports Create() and/or CreateCopy().) */*/*/*/*/*/*/*/*/*/*/

      const char *pszFormat = "GTiff";
      GDALDriver *poDriver;
      char **papszMetadata;
      poDriver = GetGDALDriverManager()->GetDriverByName(pszFormat);

      if( poDriver == NULL )
      exit( 1 );

      papszMetadata = poDriver->GetMetadata();
      if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATE, FALSE ) )
      printf( "Driver %s supports Create() method.n", pszFormat );

      if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATECOPY, FALSE ) )
      printf( "Driver %s supports CreateCopy() method.n", pszFormat );

      ///*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*Using CreateCopy()*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/

      const char*pszDstFilename= new char[256];

      GDALDataset *poSrcDS =(GDALDataset *) GDALOpen( pszDstFilename, GA_ReadOnly );
      GDALDataset *poDstDS;
      poDstDS = poDriver->CreateCopy( pszDstFilename, poSrcDS, FALSE,NULL, NULL, NULL );
      /* Once we're done, close properly the dataset */
      if( poDstDS != NULL )
      GDALClose( (GDALDatasetH) poDstDS );
      GDALClose( (GDALDatasetH) poSrcDS );

      std::cin.get();

      //delete Raster;// release the memory VERY IMPORTANT


      }






      visual-c++ console-application gdal unhandled-exception






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 3:30









      Mohamad FathinMohamad Fathin

      102




      102
























          1 Answer
          1






          active

          oldest

          votes


















          1














          You haven't set the variable pszDstFilename to anything meaningful. You allocated it, but it just contains random junk. You need to put a valid existing dataset into it for anything useful to happen in the call to GDALOpen(). The documentation states:




          Once the drivers are registered, the application should call the free standing GDALOpen() function to open a dataset, passing the name of the dataset and the access desired (GA_ReadOnly or GA_Update).







          share|improve this answer
























          • sorry i miss that and still new to c++. Thank you very much, it solve the problem.

            – Mohamad Fathin
            Nov 14 '18 at 9:37











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292784%2funhandled-exception-at-0x000007fedf2c9120-gdal202-dll-in-gdaltest-exe-0xc0000%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You haven't set the variable pszDstFilename to anything meaningful. You allocated it, but it just contains random junk. You need to put a valid existing dataset into it for anything useful to happen in the call to GDALOpen(). The documentation states:




          Once the drivers are registered, the application should call the free standing GDALOpen() function to open a dataset, passing the name of the dataset and the access desired (GA_ReadOnly or GA_Update).







          share|improve this answer
























          • sorry i miss that and still new to c++. Thank you very much, it solve the problem.

            – Mohamad Fathin
            Nov 14 '18 at 9:37
















          1














          You haven't set the variable pszDstFilename to anything meaningful. You allocated it, but it just contains random junk. You need to put a valid existing dataset into it for anything useful to happen in the call to GDALOpen(). The documentation states:




          Once the drivers are registered, the application should call the free standing GDALOpen() function to open a dataset, passing the name of the dataset and the access desired (GA_ReadOnly or GA_Update).







          share|improve this answer
























          • sorry i miss that and still new to c++. Thank you very much, it solve the problem.

            – Mohamad Fathin
            Nov 14 '18 at 9:37














          1












          1








          1







          You haven't set the variable pszDstFilename to anything meaningful. You allocated it, but it just contains random junk. You need to put a valid existing dataset into it for anything useful to happen in the call to GDALOpen(). The documentation states:




          Once the drivers are registered, the application should call the free standing GDALOpen() function to open a dataset, passing the name of the dataset and the access desired (GA_ReadOnly or GA_Update).







          share|improve this answer













          You haven't set the variable pszDstFilename to anything meaningful. You allocated it, but it just contains random junk. You need to put a valid existing dataset into it for anything useful to happen in the call to GDALOpen(). The documentation states:




          Once the drivers are registered, the application should call the free standing GDALOpen() function to open a dataset, passing the name of the dataset and the access desired (GA_ReadOnly or GA_Update).








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 4:01









          user1118321user1118321

          20k44367




          20k44367













          • sorry i miss that and still new to c++. Thank you very much, it solve the problem.

            – Mohamad Fathin
            Nov 14 '18 at 9:37



















          • sorry i miss that and still new to c++. Thank you very much, it solve the problem.

            – Mohamad Fathin
            Nov 14 '18 at 9:37

















          sorry i miss that and still new to c++. Thank you very much, it solve the problem.

          – Mohamad Fathin
          Nov 14 '18 at 9:37





          sorry i miss that and still new to c++. Thank you very much, it solve the problem.

          – Mohamad Fathin
          Nov 14 '18 at 9:37


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292784%2funhandled-exception-at-0x000007fedf2c9120-gdal202-dll-in-gdaltest-exe-0xc0000%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Xamarin.iOS Cant Deploy on Iphone

          Glorious Revolution

          Dulmage-Mendelsohn matrix decomposition in Python