c++ cli - Debug Assertion Failed with rgbConverted.cpp -


first saying, it's duplicate question, not same problem.
when run code, message showing, no error.

error

#pragma once using namespace system::drawing;  ref class rgbconvert { private:      system::drawing::bitmap^ grayimage;     system::drawing::bitmap^ bainaryimage;     system::drawing::bitmap^ rgbimage;     int xsize;     int ysize;     bool **barray;     int **grayarray;     int **binary;     file *fp;  static float coef01 = (float)0.2989; static float coef02 = (float)0.5870; static float coef03 = (float)0.1140;  public:  rgbconvert(system::drawing::bitmap^ im) {     rgbimage = im;     xsize = rgbimage->height;     ysize = rgbimage->width; }  rgbconvert(int height, int width) {     xsize = height;     ysize = width; }  int** getgrayimagearray () {     grayarray = new int * [xsize];     (int = 0; < xsize; i++ )     {         grayarray[i] = new int[ysize];     }      for( int = 0; < this->xsize; i++ )     {         ( int j = 0; j < this->ysize; j++ )         {             system::drawing::color^ clr = this->rgbimage->getpixel(j, i);             int pixel = clr->toargb();                            //int alpha = (pixel >> 24) & 0xff;// no need here             int red = (pixel >> 16) & 0xff;             int green = (pixel >>  8) & 0xff;             int blue = (pixel      ) & 0xff;              int grayc = int(coef01*red + coef02*green + coef03*blue);              grayarray[i][j] = grayc;         }// inner for*/     }      return grayarray; }  void getgrayimagearray (int** garray) {     this->grayarray = garray; }  bool** getbinaryarray( int level ) {     barray = new bool * [xsize];     (int = 0; < xsize; i++ )     {         barray[i] = new bool[ysize];     }      binary = new int * [xsize];     (int = 0; < xsize; i++ )     {         binary[i] = new int[ysize];     }     fp=fopen("c:\\binary.txt","w");      int grayc;      ( int xval = 0; xval < xsize; xval++ )     {         for( int yval = 0; yval < ysize; yval++ )         {             grayc = grayarray[xval][yval];              if ( grayc >= level )             {                 barray[xval][yval] = true;                 binary[xval][yval] = 1;                 fprintf(fp,"%d",binary[xval][yval]);             }             else             {                 barray[xval][yval] = false;                 binary[xval][yval] = 0;                 fprintf(fp,"%d",binary[xval][yval]);             }          }// inner for*/     }     fclose(fp);     return barray; } }; 

when press retry, breakpoint showing line.

fprintf(fp,"%d",binary[xval][yval]); 

if remove these lines showing breakpoint in main program.

int main(array<system::string ^> ^args) {     // enabling windows xp visual effects before controls created     application::enablevisualstyles();     application::setcompatibletextrenderingdefault(false);       // create main window , run     application::run(gcnew form1());     return 0; } 

breakpoint showing in return 0 line.

actually known problem. have solved topics. in code had created text files, docx files , images in c drives. there no permission accessing c drive in computer. had solved following steps:

  1. if can access cmd, can reset security settings in vista/windows 7 following command: "secedit /configure /cfg %windir%\inf\defltbase.inf /db defltbase.sdb /verbose" (no quotes.) see command does, go here: how restore security settings default settings?

    note: if can't access cmd when logged in, use guide system recovery options. can command line when access system recovery options screen.

  2. this command seems give ownership issue kick backside, though seems nothing has changed. go explorer, right click on c: , go properties.

  3. go security tab , advanced.

  4. go owner tab. should able click edit.

  5. if don't have administrators in list under says "change owner to:" go "other users or groups". if do, go straight step 7.

  6. on others users or groups type in "administrators" (no quotes) in bottom box. click check name , ok.

  7. click administrators , ok. you've given ownership of c:! (as long account administrator, is.)

  8. click ok on "advanced security settings..." window properties window. should have list of permissions , on before had how couldn't view permissions. progress, eh?

  9. you may need add in adminstrators group edit permissions. this, click "edit" , "add" , type "administrators" (no quotes) in bottom box. hit check name , ok.

  10. click administrators in list , tick box in allow column next "full control".

  11. click apply, you'll bunch of error messages how can't applied files , folders. ok through them all. once done, should have access c: drive once more!

source link


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -