mercredi 26 avril 2017

How to handle the error cygwin_exception::open_stackdumpfile

can someone help me to find a fix my issue i'm facing. These quind of error seems to happen very often but everytime with other problems.

I think i have an issue regarding the size of the fstream object? Like in in this posted error with the matrix: cygwin_exception::open_stackdumpfile: Dumping stack trace to *.exe.stackdump

#include<iostream>
#include<fstream>
#include<string>
#include"ReaderWriter/WriterBuild.h"

using namespace std;

string path = "";
string file = "Testdatei.dat";
string message = "hallo";
bool status;

int main(){

//Testklasse erstellen
        cout << "start" << endl;
        WriterBuild Testwriter(&path, &file);
        status = Testwriter.write(&message);
        cout << status << endl;

        //cout << "End";

        return 0;

}
#ifndef READERWRITER_WRITERBUILD_H_
#define READERWRITER_WRITERBUILD_H_
#include <string>
#include <fstream>
#include <iostream>

namespace std {

class WriterBuild {
public:
        WriterBuild(string *ppathname, string *pfilename);
        virtual ~WriterBuild();
        bool write(string *pmessage);

private:
        fstream* _pfilestream;
        void checkPath(string *ppath);

};

} /* namespace std */

#endif /* READERWRITER_WRITERBUILD_H_ */
#include "WriterBuild.h"

namespace std {

WriterBuild::WriterBuild(string *ppathname, string *pfilename) {
        // TODO Auto-generated constructor stub
        const char* pfile = pfilename->c_str();
                fstream filestream;
                filestream.open(pfile, ios::out | ios::app);
                _pfilestream = &filestream;
                if (!_pfilestream->good()){
                        cout << "Datei existiert nicht." << endl;
                }
                else{
                        cout << "Datei existiert" << endl;
                        }
                cout << _pfilestream << endl;
}

WriterBuild::~WriterBuild() {
        // TODO Auto-generated destructor stub
        cout << "destructor-start" << endl;
        cout << _pfilestream << endl;
        _pfilestream->close();
        cout << "destructor-ende" << endl;
}

bool WriterBuild::write(string *pmessage){
        cout << "test pmessage: " << pmessage << endl;

        return true;
}

void WriterBuild::checkPath(string *ppath){


}

} /* namespace std */

Output:

enter codstart
Datei existiert
0xffffc940
test pmessage: 0x100407020
1
destructor-start
0xffffc940
105 [main] CMS_W_Engine 11556 cygwin_exception::open_stackdumpfile: Dumping     stack trace to CMS_W_Engine.exe.stackdumpe here

Thanks in advance for the help

Aucun commentaire:

Enregistrer un commentaire