examples/DS401_Slave_Gui/tools.cpp
author etisserant
Sun, 30 Sep 2007 22:34:10 +0200
changeset 290 43c3b2bf3e32
parent 246 d635cfc520ee
permissions -rw-r--r--
Added debug message printing. Added socket option : CAN_RAW_LOOPBACK=1 and CAN_RAW_RECV_OWN_MSGS=0.
#include <iostream>
#include <wx/wxprec.h>
#include <wx/wx.h>
#include <wx/textctrl.h>
#include <iostream>
#include "tools.h"

 void 	IntToString( int i, char* in_pszbuffer )
{
	// permet de copier un int dans la chaƮne buffer
	sprintf( in_pszbuffer, "%d", i);
}

char	*wxstr_to_charbuf(wxString	s)
{
	int		i = 0;
	char	*str = NULL;
	
	str = (char*) malloc((s.Length() + 1) * sizeof(char));
 	for(i=0; i<s.Length(); i++)
  	  {
   		str[i] = s.GetChar(i);
  	  }
 	str[s.Length()] = '\0';
 	return(str);
}

void	charbuf_free(char	*s)
{
	free(s);
}