I'm using Dev-c++ to make a dialog-based app. I had it working, but now I am getting an error:
An Access Violation (Segmentation Fault) raised in your program.

I have narrowed it down to the winmain function:

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) {
   if (iCmdShow > 4) {
      commandlineopener=szCmdLine;
   }
   gCmdShow=iCmdShow;
   strcat(about,version);
   strcat(about,"Stuff"); //About stuffs go here
   DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), 0,(DLGPROC)MainDlgProc);
   WSACleanup();
   return 0;
}

What am I doing wrong?

tawes01
Deleted Member

I have it defined as global, right after the includes:

char about[128]="C++ dialog-based plain text editor, version ";

But I had that before, and it was working, so I don't think that's the problem...

I tried adding a MessageBox after each action in the function. The program actually crashes after WSACleanup. But that can't be right, can it? I've never heard of a problem with the return...

OK. I figured it out. Apparently, the whole strcat() stuff was doing something that it didn't like, and I moved all the data to the declaration of about. After I deleted the strcat()'s, it no longer crashed.

This question has already been answered. Start a new discussion instead.