examples/DS401_Slave_Gui/tools.cpp
changeset 295 25ff2fadff89
parent 294 d5493fe07e79
child 296 03f2b8b8cb0b
equal deleted inserted replaced
294:d5493fe07e79 295:25ff2fadff89
     1 #include <iostream>
       
     2 #include <wx/wxprec.h>
       
     3 #include <wx/wx.h>
       
     4 #include <wx/textctrl.h>
       
     5 #include <iostream>
       
     6 #include "tools.h"
       
     7 
       
     8  void 	IntToString( int i, char* in_pszbuffer )
       
     9 {
       
    10 	// permet de copier un int dans la chaƮne buffer
       
    11 	sprintf( in_pszbuffer, "%d", i);
       
    12 }
       
    13 
       
    14 char	*wxstr_to_charbuf(wxString	s)
       
    15 {
       
    16 	int		i = 0;
       
    17 	char	*str = NULL;
       
    18 	
       
    19 	str = (char*) malloc((s.Length() + 1) * sizeof(char));
       
    20  	for(i=0; i<s.Length(); i++)
       
    21   	  {
       
    22    		str[i] = s.GetChar(i);
       
    23   	  }
       
    24  	str[s.Length()] = '\0';
       
    25  	return(str);
       
    26 }
       
    27 
       
    28 void	charbuf_free(char	*s)
       
    29 {
       
    30 	free(s);
       
    31 }