Writing to dataset crash

Hi ,
I have done some VS2012 examples and from that found some code to be working.
But when integrated with Qt , cpp it crashes.
Can someone please help ?

thanks & warm regards
~ Rudresh
Here is the code :
try {

    // Create the dataspace
    hsize_t dims[2] = {ROWS, COLS};
    hsize_t max_dims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
    H5::DataSpace dataspace(2, dims, max_dims);

    // Set the dataset creation properties
    H5::DSetCreatPropList cparms;
    cparms.setChunk(2, dims);

    H5::StrType datatype(H5::PredType::C_S1, H5T_VARIABLE);


    H5::DataSet dataset = NULL;
    if ( !this->m_h5File.exists(datasetName))
    {
        // Create the dataset
        // H5::DataSet dataset = file.createDataSet(DATASET_NAME, H5::StrType(H5::PredType::C_S1), dataspace, cparms);

        dataset = m_h5File.createDataSet(datasetName, datatype, dataspace, cparms);
    }
    else
    {
        dataset =  this->m_h5File.openDataSet(datasetName);
    }


    // Create the memory dataspace
    hsize_t mem_dims[2] = {INITIAL_ROWS, COLS};
    H5::DataSpace memspace(2, mem_dims);

    // Select a hyperslab in the dataset
    hsize_t start[2] = {0, 0};
    hsize_t count[2] = {1, COLS};
    dataspace.selectHyperslab(H5S_SELECT_SET, count, start);

    // Write the data to the hyperslab in the dataset
    //dataset.write(data, H5::StrType(H5::PredType::C_S1), memspace, dataspace);


    //dataset.write("Its a string" , H5::StrType(H5::PredType::C_S1), memspace, dataspace);


    char *matrix_ext[1][5];
    matrix_ext[0][0] = (char*) "This is str1 ";
    matrix_ext[0][1] = (char*) "This is str2";
    matrix_ext[0][2] = (char*) "This is str3";
    matrix_ext[0][3] = (char*) "This is str4 ";
    matrix_ext[0][4] = (char*) "This is str5 ";

    hsize_t      dims3[2]  = { 1, 5};  // dataset dimensions at creation
    //   hsize_t      maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
    DataSpace mspace2( 2, dims3, max_dims);

    dataset.write( matrix_ext, datatype , mspace2 , dataspace );

    // Select a hyperslab in the dataset
    hsize_t start2[2] = {1, 0};
    hsize_t count2[2] = {1, COLS};
    dataspace.selectHyperslab(H5S_SELECT_SET, count2, start2);

    dataset.write( matrix_ext, datatype , mspace2 , dataspace );
    return true ;
}
catch (H5::Exception& error) {
    error.printErrorStack();
    return -1;
}

The error message is :
The inferior stopped because it triggered an exception
Stopped in thread 0 by: Exception at … read access violation at : 0xffffffffffff , flags = 0x0

Hi ,

Its fixed now. There was a columns mismatch.

thanks & Warm regards
~ Rudresh