Skip to content

Instantly share code, notes, and snippets.

somewhere in a top header file did this :
const wxEventType update_node_event = wxNewEventType(); // You get to choose the name yourself
in the constructor of a frame did this :
Connect(GetId() , update_node_event , (wxObjectEventFunction) &tcptraceFrame::update_node_data );
inside the frame class wrote this :
A::one_method()
{
//Create the thread
Create();
wxThread *a = GetThread();
if(a != NULL)
{
// go!
if (a->Run() != wxTHREAD_NO_ERROR)
#0 0x7ffff53b2d05 raise(sig=6) (../nptl/sysdeps/unix/sysv/linux/raise.c:64)
#1 0x7ffff53b6ab6 abort() (abort.c:92)
#2 0x7ffff5e876dd __gnu_cxx::__verbose_terminate_handler() () (/usr/lib/x86_64-linux-gnu/libstdc++.so.6:??)
#3 0x7ffff5e85926 ??() (/usr/lib/x86_64-linux-gnu/libstdc++.so.6:??)
#4 0x7ffff5e85953 std::terminate() () (/usr/lib/x86_64-linux-gnu/libstdc++.so.6:??)
#5 0x7ffff5e862af __cxa_pure_virtual() (/usr/lib/x86_64-linux-gnu/libstdc++.so.6:??)
#6 0x40b0a3 wxThreadHelperThread::Entry(this=0x72ab80) (/usr/include/wx-2.8/wx/thread.h:665)
#7 0x7ffff61aa851 wxThreadInternal::PthreadStart(wxThread*) () (/usr/lib/libwx_baseu-2.8.so.0:??)
#8 0x7ffff5719d8c start_thread(arg=0x7fffd7d70700) (pthread_create.c:304)
/*
* Function pointers and classes
* The program works correctly by printing 5 with the "Dont want to do this" lines
* Need to get the program working without the "Dont want to do this" lines
* */
#include<stdio.h>
class A
{
public:
#include<stdio.h>
class A
{
public:
void trial();
void log(int a)
{
#include<stdio.h>
class A
{
public:
void trial();
void log(int a)
{
#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif
#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__
#include "tcptraceMain.h"
#include "turbotrace.h"
#include<stdio.h>
#include<string.h> //strlen
#include<stdlib.h> //strlen
#include<sys/socket.h>
#include<arpa/inet.h> //inet_addr
#include<unistd.h> //write
#include<pthread.h> //for threading , link with lpthread
void *connection_handler(void *);
char *str_replace(char *search , char *replace , char *subject)
{
char *new_subject = NULL , *p = NULL , *old , *temp;
int c = 0, final_size;
new_subject = subject;
//Get new size of string
//for(p = strstr(subject , search) ; p != NULL ; p = strstr(p+strlen(search) , search))
while((p = strstr(new_subject , search)))
{
/*
* Search and replace a string with another string , in a string
* */
char *str_replace(char *search , char *replace , char *subject)
{
char *new_subject = NULL , *p , *temp;
int size;
//subject to work upon
new_subject = strdup(subject);