Code: Select all
size_t qq = ResultsFile.Length();
char *rr = (char *)malloc(qq);
ResultsFile.Read(rr, qq);
ID_ResultsBox->Replace(0, qq, ?????); // wants wxString&
As always, apologies for these lower-than-basic questions...
Thank you.
Code: Select all
size_t qq = ResultsFile.Length();
char *rr = (char *)malloc(qq);
ResultsFile.Read(rr, qq);
ID_ResultsBox->Replace(0, qq, ?????); // wants wxString&
Code: Select all
ID_ResultsBox->Replace(0, qq, wxString::Format("%s",rr));
That won't work too well in a unicode build. Better would be wxString( rr, wxConvUTF8).timg wrote:Code: Select all
ID_ResultsBox->Replace(0, qq, wxString::Format("%s",rr));
Code: Select all
error: no matching function for call to `wxString::Format(const char[3], char*&)'
Code: Select all
size_t qq = ResultsFile.Length();
wxString *rr = (wxString *)malloc(qq);
ResultsFile.ReadAll(rr, wxConvUTF8);
ID_ResultsBox->Replace(0, qq, rr);
// Last line causes a compile error:
// error: conversion from `wxString*' to `const wxString' is ambiguous
Code: Select all
size_t qq = ResultsFile.Length();
wxString rr;
ResultsFile.ReadAll(&rr, wxConvUTF8);
ID_ResultsBox->Replace(0, qq, rr);
Code: Select all
size_t qq = ResultsFile.Length();
wxString rr;
ResultsFile.ReadAll(&rr, wxConvUTF8);
ID_ResultsBox->Replace(0, qq, rr);
Code: Select all
"\0\0wxArrayStrin"
Code: Select all
wxString filename;
wxFileDialog fdlog(this, "Open a file","","","*.*");
if(fdlog.ShowModal() != wxID_OK) return;
filename = fdlog.GetPath();
wxFFile ResultsFile;
ResultsFile.Open(filename,wxT("r"));
size_t qq = ResultsFile.Length();
wxString rr;
ResultsFile.ReadAll(&rr, wxConvUTF8);
WxTextCtrl1->Replace(0, qq, rr);
You don't need to do this. A wxString knows its own length, and is better able to cope with unicode. So your 'paste' line could be:size_t qq = ResultsFile.Length();
Another possible problem is the wxConvUTF8. This is usually the correct conv to use, but maybe it's wrong for your system.but ReadAll creates unexpected characters in rr
Code: Select all
ID_ResultsBox->LoadFile(results_name, wxTEXT_TYPE_ANY);
Code: Select all
const wxString results_name = wxT("C:\\Tmp\\__reslts.res");
Hmm. The 'text' sample does LoadFile(). Try building that; copy your file into the dir holding the 'text' executable and rename it 'dummy.txt' (that being the name of the file that the sample tries to load).Drives me crazy. I must be missing something very obvious...
Code: Select all
ResultsFile_fp = ResultsFile.fp();