If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
void IntraMsg2Frm::WxButton1Click(wxCommandEvent& event)
{
// -+-+-+- SENDKNOP !!!! -+-+-+-
char argument[1073];
const char *aan = WxEdit1->GetValue().mb_str(wxConvUTF8); // Idem, maar nu voor aan.
const char *bericht = Message->GetValue().mb_str(wxConvUTF8); //De inhoud van het berichtvakje //is nu aan de char bericht gegeven.
#if defined(__WINDOWS__)
sprintf (argument,"NET SEND %s %s",aan,bericht);
system(argument);
#endif
#if defined(__LINUX__)
sprintf (argument,"echo \"%s\" | smbclient -M %s",bericht,aan);
system(argument);
wxString linmsg;
linmsg.Printf(_T("even testen of ie linux wel herkent\n")
_T("Dan hier ook maar ff het argument: \n %s")
_T("aan testen:\n %s")
_T("bericht testen:\n %s"), argument, aan, bericht );
wxMessageBox(linmsg,_T("Argument check op linux"), wxOK | wxICON_INFORMATION, this);
#endif
}
What do I do wrong?
P.S.: My system is Sabayon (Gentoo) Linux .
"When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, *for free*'." - Linus Torvalds
Maybe mb_str is the issue - in unicode builds it returns wxCharBuffer, and in ANSI the calls you make will do nothing (i.e. just the same as c_str). So, you should probably just be calling c_str instead and making sure the compilation is right; or, if you need utf8 youll need a roundtrip conversion in ANSI mode by calling wc_str with wxConvLocal and then converting it to utf8 via wxConvUTF8.cWC2MB.
Let me know if that helps .
[Mostly retired moderator, still check in to clean up some stuff]
const char *aan = WxEdit1->GetValue().wc_str(wxConvLocal); // Idem, maar nu voor aan.
const char *bericht = Message->GetValue().wc_str(wxConvLocal); //De inhoud van het berichtvakje //is nu aan de char bericht gegeven.
But now I get this error while compiling:
[quote]krisje8@localhost ~/IntraMsg2_1 $ g++ *.cpp `wx-config --libs --cxxflags` -o IntraMsg2
IntraMsg2Frm.cpp: In member function
"When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, *for free*'." - Linus Torvalds